From b4c10b4d6310c089c6d35ec5d348f2ef02cd9ea8 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Sat, 11 Aug 2018 01:08:17 +0100 Subject: [PATCH] libDtHelp: Cov 88275 --- cde/lib/DtHelp/Environ_c.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; } } -- 2.25.1