From 6eee473eba94697953e8b3e1b04fe5ef1de5f474 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 5 Jun 2012 14:15:54 +0530 Subject: core: coverity fixes (mostly resource leak fixes) currently working on obvious resource leak reports in coverity Change-Id: I261f4c578987b16da399ab5a504ad0fda0b176b1 Signed-off-by: Amar Tumballi BUG: 789278 Reviewed-on: http://review.gluster.com/3265 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/run.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libglusterfs/src/run.c') diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c index 34d75df69c2..50c1e30bfc6 100644 --- a/libglusterfs/src/run.c +++ b/libglusterfs/src/run.c @@ -67,7 +67,10 @@ runner_chio (runner_t *runner, int fd) { GF_ASSERT (fd > 0 && fd < 3); - return runner->chio[fd]; + if ((fd > 0) && (fd < 3)) + return runner->chio[fd]; + + return NULL; } static void @@ -194,7 +197,8 @@ runner_redir (runner_t *runner, int fd, int tgt_fd) { GF_ASSERT (fd > 0 && fd < 3); - runner->chfd[fd] = (tgt_fd >= 0) ? tgt_fd : -2; + if ((fd > 0) && (fd < 3)) + runner->chfd[fd] = (tgt_fd >= 0) ? tgt_fd : -2; } int -- cgit