diff options
author | Thomas White <taw@physics.org> | 2019-09-03 15:27:15 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-09-03 15:29:34 +0200 |
commit | 628e263dce6ca70b06c60904d4de568b87a833f7 (patch) | |
tree | a8ba60d6bf01b60f5ec4cc25950cea3dfef34ae7 /libcrystfel | |
parent | edf2e9869600d1779383317f4b2f661faff9a0e3 (diff) |
Fix memory leaks in cell comparison
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/cell-utils.c | 4 | ||||
-rw-r--r-- | libcrystfel/src/index.c | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index c59d7f96..0365b426 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -2152,6 +2152,8 @@ static IntegerMatrix *check_permutations(UnitCell *cell_reduced, UnitCell *refer } } + intmat_free(m); + if ( n_best == 0 ) return NULL; sel = n_best; @@ -2309,7 +2311,9 @@ UnitCell *compare_reindexed_cell_parameters(UnitCell *cell_in, match = NULL; } + rtnl_mtx_free(CiARA); rtnl_mtx_free(CiA); + intmat_free(RiBCB); intmat_free(RA); intmat_free(RB); intmat_free(CB); diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index af4385cd..36d7b84b 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -539,10 +539,10 @@ static int check_cell(IndexingFlags flags, Crystal *cr, UnitCell *target, /* Check at all? */ if ( !(flags & INDEXING_CHECK_CELL) ) return 0; - if ( compare_reindexed_cell_parameters(crystal_get_cell(cr), target, - tolerance, &rm) ) - { - out = cell_transform_rational(crystal_get_cell(cr), rm); + out = compare_reindexed_cell_parameters(crystal_get_cell(cr), target, + tolerance, &rm); + + if ( out != NULL ) { cell_free(crystal_get_cell(cr)); crystal_set_cell(cr, out); rtnl_mtx_free(rm); |