log: fix memory leak 25/171125/3
authorBoram Park <boram1288.park@samsung.com>
Mon, 26 Feb 2018 23:36:53 +0000 (08:36 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 27 Feb 2018 00:19:12 +0000 (09:19 +0900)
Change-Id: I50b1de495e6af2562832d2bc363991aaa17fef0d

common/tdm_log.c

index 996618d37629731fb2fd2757ca72c8acfc458488..46307709aa5f239b365e0a9671c032ab84200267 100644 (file)
@@ -131,7 +131,11 @@ tdm_log_set_path(const char *path)
                if (stdout_fd == -1) {
                        fflush(stdout);
                        stdout_fd = dup(STDOUT_FILENO);
-                       TDM_RETURN_IF_FAIL(stdout_fd != -1);
+                       if (stdout_fd < 0) {
+                               TDM_ERR("dup failed: %m\n");
+                               fclose(log_fl);
+                               return;
+                       }
                }
 
                setvbuf(log_fl, NULL, _IOLBF, 512);