diff options
author | Thomas White <taw@physics.org> | 2014-01-21 11:18:46 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-01-21 11:24:47 +0100 |
commit | 98879100c72e0db3e1861f0bb3b6557f834be133 (patch) | |
tree | 7a01de628c2cf220126cefb9296bae38e052f81f | |
parent | 233487cb155a6ad7a3f7443e6da90f3b08d2ff61 (diff) |
Free det->defaults.clen_from only once
The "defaults" structure gets copied along with everything else by copy_geom().
Therefore, the same pointer might end up in two places leading to a double free.
Better to free it once only after reading the geometry.
-rw-r--r-- | libcrystfel/src/detector.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c index a5dc12f7..99205e67 100644 --- a/libcrystfel/src/detector.c +++ b/libcrystfel/src/detector.c @@ -1037,6 +1037,8 @@ out: det->max_fs = max_fs; det->max_ss = max_ss; + free(det->defaults.clen_from); + /* Calculate matrix inverses and other stuff */ for ( i=0; i<det->n_panels; i++ ) { @@ -1085,8 +1087,6 @@ void free_detector_geometry(struct detector *det) rigid_groups_free(det); - free(det->defaults.clen_from); - for ( i=0; i<det->n_panels; i++ ) { free(det->panels[i].clen_from); } |