aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-12 09:58:15 -0700
committerThomas White <taw@bitwiz.org.uk>2010-06-12 09:58:15 -0700
commit8877eba26cf5b8846e5f0cd9082207bc86ca9a94 (patch)
tree53653ee6d9785ef79b38964998a4187096dc1c51 /src
parent03bf040e4b377c3434bf2704527326f78e76e77c (diff)
calibrate_detector: Fix memory errors
Diffstat (limited to 'src')
-rw-r--r--src/calibrate-detector.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/calibrate-detector.c b/src/calibrate-detector.c
index 5341e599..d411c2c6 100644
--- a/src/calibrate-detector.c
+++ b/src/calibrate-detector.c
@@ -324,23 +324,29 @@ int main(int argc, char *argv[])
if ( worker_args[i]->filename != NULL ) {
free(worker_args[i]->filename);
}
- free(worker_args[i]);
}
- /* Sum the individual sums */
+ /* Add the individual sums to the 0th sum */
for ( i=1; i<nthreads; i++ ) {
+
int x, y;
+
for ( x=0; x<w; x++ ) {
for ( y=0; y<h; y++ ) {
float val = worker_args[i]->sum[x+w*y];
worker_args[0]->sum[x+w*y] += val;
}
}
+ free(worker_args[i]->sum);
+ free(worker_args[i]);
+
}
hdf5_write(outfile, worker_args[0]->sum, w, h, H5T_NATIVE_FLOAT);
+ free(worker_args[0]->sum);
+ free(worker_args[0]);
free(prefix);
free(outfile);
fclose(fh);