Closed pavoljuhas closed 6 years ago
I have tested libdiffpy linked with ObjCryst with valgrind and it reported some leaks in CrystVector. This should address that.
Problem: Copy constructor of CrystVector allocates zero-length buffer, but resize() method does not delete it. https://github.com/vincefn/objcryst/blob/65ab262c33f7528f26f6dac1ff1a1103e7b2099d/ObjCryst/CrystVector/CrystVector.cpp#L58-L61
Solution: Always delete the old buffer unless a reference. The pointer for unallocated buffer is NULL so its deletion is safe.
Sorry I had not seen this pull request before
I have tested libdiffpy linked with ObjCryst with valgrind and it reported some leaks in CrystVector. This should address that.
Problem: Copy constructor of CrystVector allocates zero-length buffer, but resize() method does not delete it. https://github.com/vincefn/objcryst/blob/65ab262c33f7528f26f6dac1ff1a1103e7b2099d/ObjCryst/CrystVector/CrystVector.cpp#L58-L61
Solution: Always delete the old buffer unless a reference. The pointer for unallocated buffer is NULL so its deletion is safe.