From: Jon Trulson Date: Sun, 1 Apr 2018 19:54:22 +0000 (-0600) Subject: dtexec,DtSvc/MsgLog.c: coverity CID 89585; resource leak X-Git-Tag: 2.2.4a~149 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5729327cc8e76a3a6c3e94096c91b92a3fe09eed;p=oweals%2Fcde.git dtexec,DtSvc/MsgLog.c: coverity CID 89585; resource leak --- diff --git a/cde/lib/DtSvc/DtUtil2/MsgLog.c b/cde/lib/DtSvc/DtUtil2/MsgLog.c index 0aa48d1d..8997b745 100644 --- a/cde/lib/DtSvc/DtUtil2/MsgLog.c +++ b/cde/lib/DtSvc/DtUtil2/MsgLog.c @@ -141,7 +141,7 @@ static char * get_file_name ( const char * format, ... ) { - char *file, *rtn; + char *file; va_list args; file = malloc(MAXPATHLEN+1); @@ -153,11 +153,12 @@ static char * get_file_name ( va_end (args); if ((*fp = fopen (file, type)) == NULL) - return (NULL); - - rtn = strdup (file); - free(file); - return rtn; + { + free(file); + return (NULL); + } + + return file; }