Commit c81d04eb authored by Thomas White's avatar Thomas White
Browse files

Fix unit cell point group memory leak

parent 9526f8c6
......@@ -86,6 +86,13 @@ UnitCell *cell_new()
}
void cell_free(UnitCell *cell)
{
free(cell->pointgroup);
free(cell);
}
void cell_set_parameters(UnitCell *cell, double a, double b, double c,
double alpha, double beta, double gamma)
{
......
......@@ -28,6 +28,7 @@ typedef struct _unitcell UnitCell;
extern UnitCell *cell_new(void);
extern UnitCell *cell_new_from_cell(UnitCell *orig);
extern void cell_free(UnitCell *cell);
/* Lengths in m, angles in radians */
extern UnitCell *cell_new_from_parameters(double a, double b, double c,
......
......@@ -324,7 +324,7 @@ int main(int argc, char *argv[])
find_intersections(&image, cell, da, dw, &np, 1);
hdfile_close(hdfile);
free(cell);
cell_free(cell);
free(filename);
free(image.data);
free(image.flags);
......
......@@ -176,6 +176,6 @@ void index_pattern(struct image *image, UnitCell *cell, IndexingMethod indm,
done:
for ( i=0; i<image->ncells; i++ ) {
free(image->candidate_cells[i]);
cell_free(image->candidate_cells[i]);
}
}
......@@ -433,7 +433,7 @@ static struct process_result process_image(struct process_args *pargs)
free(simage);
/* Only free cell if found */
free(image.indexed_cell);
cell_free(image.indexed_cell);
done:
free(image.data);
......@@ -865,7 +865,7 @@ int main(int argc, char *argv[])
free(prefix);
free(det->panels);
free(det);
free(cell);
cell_free(cell);
fclose(fh);
STATUS("There were %i images.\n", n_images);
......
......@@ -477,7 +477,7 @@ skip:
free(image.det->panels);
free(image.det);
free(powder);
free(cell);
cell_free(cell);
free(intensities);
free(outfile);
free(filename);
......
......@@ -687,7 +687,7 @@ int main(int argc, char *argv[])
free(model);
free(counts);
free(output);
free(cell);
cell_free(cell);
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment