diff options
author | Thomas White <taw@physics.org> | 2023-07-26 17:20:44 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-07-26 17:20:44 +0200 |
commit | e1001a658eb3b4328ddf086ef1d4f68b562ceb85 (patch) | |
tree | eb6dd1b8156d0608d26c03689f35d1d625bfdf5b /libcrystfel | |
parent | 18055d900d4566f01db478d2df381acb013559e7 (diff) |
asdf: Fix a memory leak
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/indexers/asdf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libcrystfel/src/indexers/asdf.c b/libcrystfel/src/indexers/asdf.c index b1c1246a..f6899331 100644 --- a/libcrystfel/src/indexers/asdf.c +++ b/libcrystfel/src/indexers/asdf.c @@ -218,7 +218,6 @@ static int asdf_cell_memcpy(struct asdf_cell *dest, struct asdf_cell *src) dest->volume = src->volume; int n = src->N_refls; - dest->N_refls = n; dest->n = src->n; memcpy(dest->reflections, src->reflections, sizeof(int) * n); @@ -226,6 +225,10 @@ static int asdf_cell_memcpy(struct asdf_cell *dest, struct asdf_cell *src) for (i = 0; i < n; i++ ) { memcpy(dest->indices[i], src->indices[i], sizeof(double) * 3); } + for ( i=n; i<dest->N_refls; i++ ) { + free(dest->indices[i]); + } + dest->N_refls = n; dest->acl = src->acl; dest->n_max = src->n_max; |