diff options
author | Thomas White <taw@physics.org> | 2010-03-17 14:09:49 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-03-17 14:09:49 +0100 |
commit | 274a5e2803eb3afe0d53b27c6078ef4495d587a0 (patch) | |
tree | a1bc21d37e94ff5450cddc148cd33227b30f94ad /src/cell.c | |
parent | f38be837bd33dfc4d98d251b2e81d5fa555a4f5c (diff) |
Fix various memory leaks and tidy a few things
Diffstat (limited to 'src/cell.c')
-rw-r--r-- | src/cell.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -262,11 +262,25 @@ static UnitCell *cell_new_from_axes(struct rvec as, struct rvec bs, cell->cy = gsl_matrix_get(inv, 2, 1); cell->cz = gsl_matrix_get(inv, 2, 2); + gsl_matrix_free(inv); + cell_update_crystallographic(cell); return cell; } +UnitCell *cell_new_from_cell(UnitCell *orig) +{ + UnitCell *new; + + new = malloc(sizeof(UnitCell)); + + *new = *orig; + + return new; +} + + void cell_get_cartesian(UnitCell *cell, double *ax, double *ay, double *az, double *bx, double *by, double *bz, @@ -321,6 +335,8 @@ void cell_get_reciprocal(UnitCell *cell, *asz = gsl_matrix_get(inv, 2, 0); *bsz = gsl_matrix_get(inv, 2, 1); *csz = gsl_matrix_get(inv, 2, 2); + + gsl_matrix_free(inv); } |