aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-06-16 17:28:49 +0200
committerThomas White <taw@physics.org>2015-01-29 13:23:37 +0100
commit5a397b385b52f2379ab605797ce2b9fb4ea1d534 (patch)
treebe2c28899c5af5cf5a50ecfb0c31d9974b362baa /src
parent6bd11e25471511d665bba18c75b7fc1dd93332de (diff)
Fix memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/whirligig.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/whirligig.c b/src/whirligig.c
index ed25e887..23a1060d 100644
--- a/src/whirligig.c
+++ b/src/whirligig.c
@@ -59,13 +59,12 @@ static int cells_are_similar(UnitCell *cell1, UnitCell *cell2)
{
double asx1, asy1, asz1, bsx1, bsy1, bsz1, csx1, csy1, csz1;
double asx2, asy2, asz2, bsx2, bsy2, bsz2, csx2, csy2, csz2;
- UnitCellTransformation *tfn1, *tfn2;
UnitCell *pcell1, *pcell2;
const double atl = deg2rad(5.0);
/* Compare primitive cells, not centered */
- pcell1 = uncenter_cell(cell1, &tfn1);
- pcell2 = uncenter_cell(cell2, &tfn2);
+ pcell1 = uncenter_cell(cell1, NULL);
+ pcell2 = uncenter_cell(cell2, NULL);
cell_get_reciprocal(pcell1, &asx1, &asy1, &asz1,
&bsx1, &bsy1, &bsz1,
@@ -122,6 +121,8 @@ static int gatinator(UnitCell *a, UnitCell *b, IntegerMatrix **pmb)
if ( cells_are_similar(a, nc) ) {
*pmb = m;
+ tfn_free(tfn);
+ cell_free(nc);
return 1;
}
@@ -172,6 +173,7 @@ static void dump(struct image *win, signed int *ser, IntegerMatrix **mat,
for ( i=0; i<pos; i++ ) {
free_all_crystals(&win[i]);
intmat_free(mat[i]);
+ free(win[i].filename);
}
memmove(win, &win[pos], (window_len-pos)*sizeof(struct image *));
@@ -329,6 +331,7 @@ int main(int argc, char *argv[])
close_stream(st);
+ dump(win, ser, mat, window_len, 1);
free(win);
free(ser);
free(mat);