]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix possible memory leak
authorEric Bollengier <eric@eb.homelinux.org>
Tue, 19 Jan 2010 16:03:25 +0000 (17:03 +0100)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 19 Jan 2010 16:03:25 +0000 (17:03 +0100)
bacula/src/lib/bpipe.c

index 5586d6baf7ce6279e6566b27624bdbe75178185b..89917741953d020c6c2d17347191704df8845f79 100644 (file)
@@ -403,7 +403,8 @@ int run_program_full_output(char *prog, int wait, POOLMEM *&results)
    mode = (char *)"r";
    bpipe = open_bpipe(prog, wait, mode);
    if (!bpipe) {
-      return ENOENT;
+      stat1 = ENOENT;
+      goto bail_out;
    }
    
    sm_check(__FILE__, __LINE__, false);
@@ -449,6 +450,7 @@ int run_program_full_output(char *prog, int wait, POOLMEM *&results)
    stat1 = stat2 != 0 ? stat2 : stat1;
    
    Dmsg1(900, "Run program returning %d\n", stat1);
+bail_out:
    free_pool_memory(tmp);
    free(buf);
    return stat1;