From e1001a658eb3b4328ddf086ef1d4f68b562ceb85 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 26 Jul 2023 17:20:44 +0200 Subject: asdf: Fix a memory leak --- libcrystfel/src/indexers/asdf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libcrystfel') 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; iN_refls; i++ ) { + free(dest->indices[i]); + } + dest->N_refls = n; dest->acl = src->acl; dest->n_max = src->n_max; -- cgit v1.2.3