dtmail/DtMailRc.C: coverity CID 88975; use after free
authorJon Trulson <jon@radscan.com>
Sat, 31 Mar 2018 23:46:53 +0000 (17:46 -0600)
committerJon Trulson <jon@radscan.com>
Sat, 31 Mar 2018 23:46:53 +0000 (17:46 -0600)
cde/programs/dtmail/libDtMail/Common/DtMailRc.C

index f251fa5b54a4d13b3e366e118edaea1736a99f16..14df67bd901042323a58502f5944e98c3e9d4c63 100644 (file)
@@ -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);