From: Peter Howkins Date: Sat, 11 Aug 2018 00:08:17 +0000 (+0100) Subject: libDtHelp: Cov 88275 X-Git-Tag: 2.3.0a~32 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b4c10b4d6310c089c6d35ec5d348f2ef02cd9ea8;p=oweals%2Fcde.git libDtHelp: Cov 88275 --- diff --git a/cde/lib/DtHelp/Environ_c.c b/cde/lib/DtHelp/Environ_c.c index 516278db..3e799023 100644 --- a/cde/lib/DtHelp/Environ_c.c +++ b/cde/lib/DtHelp/Environ_c.c @@ -74,6 +74,7 @@ char * _DtCliSrvGetDtUserSession(void) char screen[BUFSIZ]; char * display = NULL; char * localDisplayVar = getenv("DISPLAY"); + int needsfree = 0; if (localDisplayVar == NULL) { @@ -98,6 +99,7 @@ char * _DtCliSrvGetDtUserSession(void) } else { display = malloc(strlen(localDisplayVar) + 1); + needsfree = 1; strcpy(display, localDisplayVar); } @@ -120,6 +122,10 @@ char * _DtCliSrvGetDtUserSession(void) if (envVar) sprintf (envVar, "%s-%s-%s", logname, display, screen); + if(needsfree) { + free(display); + } + return envVar; } }