libdtsvc: Resolve coverity warnings related to 'dereference before null check' related to free()

This commit is contained in:
Peter Howkins
2018-04-02 22:10:46 +01:00
parent b0c5941e3e
commit acc3d8868a
10 changed files with 78 additions and 87 deletions

View File

@@ -934,8 +934,7 @@ _DtEnvRemove(
rather than try to do it ourselves.
*/
if (str)
unsetenv(str);
unsetenv(str);
#else
freeMe = pEnviron2[index];
@@ -1021,11 +1020,11 @@ _AddToPath (
if (sPath != NULL)
{
sNew = XtRealloc (sPath, 1+strlen(sPath)+1+strlen(sDir));
sNew = XtRealloc (sPath, strlen(sPath) + 1 + strlen(sDir) + 1);
}
else
{
sNew = XtMalloc (1+strlen(sPath)+1+strlen(sDir));
sNew = XtMalloc (1 + strlen(sDir) + 1);
}
strcat (sNew, ":");
@@ -1187,7 +1186,7 @@ _DtWsmSetBackdropSearchPath (
if (postDtEnvironmentString != postDtEnvironmentStringBuf)
{
if (postDtEnvironmentString) XtFree(postDtEnvironmentString);
XtFree(postDtEnvironmentString);
postDtEnvironmentString = NULL;
}