From ecee8b3f3ad68b4bc2bc048da447c0fd89fa5f65 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Sat, 31 Mar 2018 17:46:53 -0600 Subject: [PATCH] dtmail/DtMailRc.C: coverity CID 88975; use after free --- cde/programs/dtmail/libDtMail/Common/DtMailRc.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cde/programs/dtmail/libDtMail/Common/DtMailRc.C b/cde/programs/dtmail/libDtMail/Common/DtMailRc.C index f251fa5b..14df67bd 100644 --- a/cde/programs/dtmail/libDtMail/Common/DtMailRc.C +++ b/cde/programs/dtmail/libDtMail/Common/DtMailRc.C @@ -2015,6 +2015,7 @@ DtMail::MailRc::expand(char *name) register char *cp, *Shell; int s, pivec[2]; struct stat sbuf; + char *retchr = NULL; if (name[0] == '+' && getfolderdir(cmdbuf) >= 0) { sprintf(xname, "%s/%s", cmdbuf, name + 1); @@ -2084,9 +2085,10 @@ DtMail::MailRc::expand(char *name) goto err; } + retchr = strdup(xname); delete [] xname; delete [] cmdbuf; - return(strdup(xname)); + return(retchr); err: fflush(stderr); -- 2.25.1