X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Flib%2Fbpipe.c;h=b87f106ab53b99310f4ce7afc9971eb5f0823a14;hb=refs%2Ftags%2FRelease-1.38.11;hp=ca8291366355dbb0fca49dceb68612df423ed147;hpb=d96e3d4b7a67d43be92cc420fb059cb13077b89a;p=bacula%2Fbacula diff --git a/bacula/src/lib/bpipe.c b/bacula/src/lib/bpipe.c index ca82913663..b87f106ab5 100644 --- a/bacula/src/lib/bpipe.c +++ b/bacula/src/lib/bpipe.c @@ -6,7 +6,7 @@ * Version $Id$ */ /* - Copyright (C) 2002-2005 Kern Sibbald + Copyright (C) 2002-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -62,13 +62,13 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode) printf("argc=%d argv=%s:\n", i, bargv[i]); } #endif - free_pool_memory(tprog); /* Each pipe is one way, write one end, read the other, so we need two */ if (mode_write && pipe(writep) == -1) { save_errno = errno; free(bpipe); errno = save_errno; + free_pool_memory(tprog); return NULL; } if (mode_read && pipe(readp) == -1) { @@ -79,6 +79,7 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode) } free(bpipe); errno = save_errno; + free_pool_memory(tprog); return NULL; } /* Start worker process */ @@ -95,6 +96,7 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode) } free(bpipe); errno = save_errno; + free_pool_memory(tprog); return NULL; case 0: /* child */ @@ -120,11 +122,10 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode) } exit(255); /* unknown errno */ - - default: /* parent */ break; } + free_pool_memory(tprog); if (mode_read) { close(readp[1]); /* close unused parent fds */ bpipe->rfd = fdopen(readp[0], "r"); /* open file descriptor */