aboutsummaryrefslogtreecommitdiff
path: root/src/indexamajig.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-01-26 17:57:44 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:12 +0100
commite3a2807bedf1a1a9e25923ee9bc0db653c4c4033 (patch)
treec8bb22ff1ab2b38e37fa70d545c6bdcc0cf0e7b7 /src/indexamajig.c
parenteb24fd94de4e5d59b691acf0b1bfd43de64d66c1 (diff)
Fix many small memory leaks
Diffstat (limited to 'src/indexamajig.c')
-rw-r--r--src/indexamajig.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 411a1b63..c997ed12 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -461,7 +461,10 @@ static void *get_image(void *qp)
} else {
rval = fgets(line, 1023, qargs->fh);
- if ( rval == NULL ) return NULL;
+ if ( rval == NULL ) {
+ free(pargs);
+ return NULL;
+ }
chomp(line);
pargs->filename = malloc(strlen(qargs->prefix)+strlen(line)+1);
snprintf(pargs->filename, 1023, "%s%s", qargs->prefix, line);
@@ -884,11 +887,14 @@ int main(int argc, char *argv[])
cleanup_indexing(ipriv);
+ free(indm);
+ free(ipriv);
free(prefix);
free(det->panels);
free(det);
cell_free(cell);
- if ( fh != stdout ) fclose(fh);
+ if ( fh != stdin ) fclose(fh);
+ if ( ofh != stdout ) fclose(ofh);
free(sym);
STATUS("There were %i images, of which %i could be indexed.\n",