Commit 57a44a97 authored by Thomas White's avatar Thomas White
Browse files

More memory leaks and exit paths

parent cc22322a
...@@ -428,8 +428,6 @@ static void run_work(const struct index_args *iargs, ...@@ -428,8 +428,6 @@ static void run_work(const struct index_args *iargs,
fh = fdopen(filename_pipe, "r"); fh = fdopen(filename_pipe, "r");
if ( fh == NULL ) { if ( fh == NULL ) {
ERROR("Failed to fdopen() the filename pipe!\n"); ERROR("Failed to fdopen() the filename pipe!\n");
close(filename_pipe);
close(results_pipe);
return; return;
} }
...@@ -450,7 +448,7 @@ static void run_work(const struct index_args *iargs, ...@@ -450,7 +448,7 @@ static void run_work(const struct index_args *iargs,
continue; continue;
} else { } else {
ERROR("Read error!\n"); ERROR("Read error!\n");
return; break;
} }
} }
...@@ -482,7 +480,6 @@ static void run_work(const struct index_args *iargs, ...@@ -482,7 +480,6 @@ static void run_work(const struct index_args *iargs,
/* close my pipes */ /* close my pipes */
fclose(fh); fclose(fh);
close(results_pipe);
cleanup_indexing(iargs->ipriv); cleanup_indexing(iargs->ipriv);
free(iargs->indm); free(iargs->indm);
...@@ -1034,6 +1031,7 @@ int main(int argc, char *argv[]) ...@@ -1034,6 +1031,7 @@ int main(int argc, char *argv[])
ERROR("Invalid parameters for '--int-radius'\n"); ERROR("Invalid parameters for '--int-radius'\n");
return 1; return 1;
} }
free(intrad);
} else { } else {
STATUS("WARNING: You did not specify --int-radius.\n"); STATUS("WARNING: You did not specify --int-radius.\n");
STATUS("WARNING: I will use the default values, which are" STATUS("WARNING: I will use the default values, which are"
...@@ -1272,16 +1270,16 @@ int main(int argc, char *argv[]) ...@@ -1272,16 +1270,16 @@ int main(int argc, char *argv[])
for ( j=0; j<n_proc; j++ ) { for ( j=0; j<n_proc; j++ ) {
if ( i != j ) close(stream_pipe_write[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(prefix);
free(use_this_one_instead); free(use_this_one_instead);
free(filename_pipes); free(filename_pipes);
free(result_fhs); free(result_fhs);
fclose(fh); fclose(fh);
free(pids); 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 /* Child process gets the 'read' end of the filename
* pipe, and the 'write' end of the result pipe. */ * pipe, and the 'write' end of the result pipe. */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment