diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-21 17:29:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-21 17:29:06 +0000 |
commit | 052aea24515d4b7b63afacb9e2170dd67523500e (patch) | |
tree | 898a80e756201b1b58828b47fd9cf3ca473e3547 /src | |
parent | 5ab6366f0b0e0cf98761236f97963bc5d3c8e47d (diff) | |
download | gnunet-052aea24515d4b7b63afacb9e2170dd67523500e.tar.gz gnunet-052aea24515d4b7b63afacb9e2170dd67523500e.zip |
-fix double close/free
Diffstat (limited to 'src')
-rw-r--r-- | src/util/os_priority.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 12dba6a6b..b967445f3 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -640,6 +640,7 @@ start_process (int pipe_control, | |||
640 | { | 640 | { |
641 | struct GNUNET_DISK_PipeHandle *childpipe; | 641 | struct GNUNET_DISK_PipeHandle *childpipe; |
642 | int dup_childpipe_read_fd = -1; | 642 | int dup_childpipe_read_fd = -1; |
643 | |||
643 | childpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_YES, GNUNET_NO); | 644 | childpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_YES, GNUNET_NO); |
644 | if (NULL == childpipe) | 645 | if (NULL == childpipe) |
645 | return NULL; | 646 | return NULL; |
@@ -651,9 +652,9 @@ start_process (int pipe_control, | |||
651 | &childpipe_read_fd, sizeof (int))) || | 652 | &childpipe_read_fd, sizeof (int))) || |
652 | (-1 == (dup_childpipe_read_fd = dup (childpipe_read_fd)))) | 653 | (-1 == (dup_childpipe_read_fd = dup (childpipe_read_fd)))) |
653 | { | 654 | { |
654 | if (childpipe_read) | 655 | if (NULL != childpipe_read) |
655 | GNUNET_DISK_file_close (childpipe_read); | 656 | GNUNET_DISK_file_close (childpipe_read); |
656 | if (childpipe_write) | 657 | if (NULL != childpipe_write) |
657 | GNUNET_DISK_file_close (childpipe_write); | 658 | GNUNET_DISK_file_close (childpipe_write); |
658 | if (0 <= dup_childpipe_read_fd) | 659 | if (0 <= dup_childpipe_read_fd) |
659 | close (dup_childpipe_read_fd); | 660 | close (dup_childpipe_read_fd); |
@@ -664,7 +665,6 @@ start_process (int pipe_control, | |||
664 | } | 665 | } |
665 | else | 666 | else |
666 | { | 667 | { |
667 | childpipe_read = NULL; | ||
668 | childpipe_write = NULL; | 668 | childpipe_write = NULL; |
669 | childpipe_read_fd = -1; | 669 | childpipe_read_fd = -1; |
670 | } | 670 | } |
@@ -711,9 +711,7 @@ start_process (int pipe_control, | |||
711 | int eno = errno; | 711 | int eno = errno; |
712 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork"); | 712 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork"); |
713 | GNUNET_array_grow (lscp, ls, 0); | 713 | GNUNET_array_grow (lscp, ls, 0); |
714 | if (childpipe_read) | 714 | if (NULL != childpipe_write) |
715 | GNUNET_DISK_file_close (childpipe_read); | ||
716 | if (childpipe_write) | ||
717 | GNUNET_DISK_file_close (childpipe_write); | 715 | GNUNET_DISK_file_close (childpipe_write); |
718 | if (0 <= childpipe_read_fd) | 716 | if (0 <= childpipe_read_fd) |
719 | close (childpipe_read_fd); | 717 | close (childpipe_read_fd); |