From 633b47c67eaba6f9c6ffb76b282f5c76e6e7fe25 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 27 Feb 2018 08:36:53 +0900 Subject: [PATCH] log: fix memory leak Change-Id: I50b1de495e6af2562832d2bc363991aaa17fef0d --- common/tdm_log.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/tdm_log.c b/common/tdm_log.c index 996618d3..46307709 100644 --- a/common/tdm_log.c +++ b/common/tdm_log.c @@ -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); -- 2.34.1