From: ho.namkoong Date: Tue, 21 Jan 2014 07:49:10 +0000 (+0900) Subject: SDB: fix prevent critical bug X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F15435%2F1;p=sdk%2Ftools%2Fsdb.git SDB: fix prevent critical bug fix resource leak Change-Id: I50d6cf711b0112c798a18c283952faf08e283a27 Signed-off-by: ho.namkoong --- diff --git a/src/auto_complete.c b/src/auto_complete.c index 79c19d6..51754bc 100644 --- a/src/auto_complete.c +++ b/src/auto_complete.c @@ -218,20 +218,24 @@ static int initialize_ac(int complete) { null_fd = unix_open("/dev/null", O_WRONLY); if(null_fd < 0) { + sdb_close(null_fd); fprintf(stderr, "error: exception happend while opening /dev/null '%s'\n", strerror(errno)); return -1; } if(dup2(null_fd, STDOUT_FILENO) < 0){ + sdb_close(null_fd); fprintf(stderr, "error: exception happend while duplicating /dev/null to the stdout '%s'\n", strerror(errno)); return -1; } if(dup2(null_fd, STDERR_FILENO) < 0){ + sdb_close(null_fd); fprintf(stderr, "error: exception happend while duplicating /dev/null to the stderr '%s'\n", strerror(errno)); return -1; } + sdb_close(null_fd); return 0; } @@ -333,6 +337,8 @@ static int parse_uninstall(int argc, char** argv) { } } } + + free(pkg_id_tokens); } return -1;