aboutsummaryrefslogtreecommitdiff
path: root/src/indexamajig.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-07-13 18:52:35 +0200
committerThomas White <taw@physics.org>2012-07-13 18:52:35 +0200
commit57a44a9738308d73ada759b5663c84dc0f535256 (patch)
treef8449fc4cb9b767cbc978adc1f960cad7bbfe4b2 /src/indexamajig.c
parentcc22322a0365213994647b9ba0bc04d0eec04217 (diff)
More memory leaks and exit paths
Diffstat (limited to 'src/indexamajig.c')
-rw-r--r--src/indexamajig.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index f560b7b8..b8e57048 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -428,8 +428,6 @@ static void run_work(const struct index_args *iargs,
fh = fdopen(filename_pipe, "r");
if ( fh == NULL ) {
ERROR("Failed to fdopen() the filename pipe!\n");
- close(filename_pipe);
- close(results_pipe);
return;
}
@@ -450,7 +448,7 @@ static void run_work(const struct index_args *iargs,
continue;
} else {
ERROR("Read error!\n");
- return;
+ break;
}
}
@@ -482,7 +480,6 @@ static void run_work(const struct index_args *iargs,
/* close my pipes */
fclose(fh);
- close(results_pipe);
cleanup_indexing(iargs->ipriv);
free(iargs->indm);
@@ -1034,6 +1031,7 @@ int main(int argc, char *argv[])
ERROR("Invalid parameters for '--int-radius'\n");
return 1;
}
+ free(intrad);
} else {
STATUS("WARNING: You did not specify --int-radius.\n");
STATUS("WARNING: I will use the default values, which are"
@@ -1272,16 +1270,16 @@ int main(int argc, char *argv[])
for ( j=0; j<n_proc; j++ ) {
if ( i != j ) close(stream_pipe_write[j]);
}
+ for ( j=0; j<i-1; j++ ) {
+ fclose(result_fhs[j]);
+ close(filename_pipes[j]);
+ }
free(prefix);
free(use_this_one_instead);
free(filename_pipes);
free(result_fhs);
fclose(fh);
free(pids);
- for ( j=0; j<i-1; j++ ) {
- fclose(result_fhs[j]);
- close(filename_pipes[j]);
- }
/* Child process gets the 'read' end of the filename
* pipe, and the 'write' end of the result pipe. */