1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

dtsession/SmRestore: fixup 8 coverity issues.

This commit is contained in:
Jon Trulson 2014-12-27 18:19:55 -07:00
parent 65dcf12c82
commit a657f302f7

View file

@ -590,7 +590,7 @@ RestoreState( void )
fileSize = MAXLINE + 1; fileSize = MAXLINE + 1;
} }
line = (unsigned char *) malloc ((fileSize + 1) * sizeof(char *)); line = malloc(fileSize + 1);
if (line == NULL) if (line == NULL)
{ {
line = fallBackLine; line = fallBackLine;
@ -828,6 +828,8 @@ RestoreResources( Boolean errorHandlerInstalled, ... )
char *argv[20]; char *argv[20];
va_list args; va_list args;
#if 0
/* JET - this seems like a bad (and unused) idea */
/* /*
* Check for alternate resource loader. * Check for alternate resource loader.
*/ */
@ -835,6 +837,9 @@ RestoreResources( Boolean errorHandlerInstalled, ... )
{ {
pgrm = CDE_INSTALLATION_TOP "/bin/dtsession_res"; pgrm = CDE_INSTALLATION_TOP "/bin/dtsession_res";
} }
#else
pgrm = CDE_INSTALLATION_TOP "/bin/dtsession_res";
#endif
/* /*
* By convention, exec() wants arg0 to be the program name. Ex: if pgrm * By convention, exec() wants arg0 to be the program name. Ex: if pgrm
@ -1286,7 +1291,7 @@ RestoreSettings( void )
ptrSize += 50; ptrSize += 50;
restorePtrArray = (char **)SM_REALLOC((char *) restorePtrArray = (char **)SM_REALLOC((char *)
restorePtrArray, ptrSize * restorePtrArray, ptrSize *
sizeof(char **)); sizeof(char *));
if(restorePtrArray == NULL) if(restorePtrArray == NULL)
{ {
PrintErrnoError(DtError, smNLS.cantMallocErrorString); PrintErrnoError(DtError, smNLS.cantMallocErrorString);
@ -2065,6 +2070,7 @@ RestoreClients( void )
SM_FREE((char *) remoteBuf[i]); SM_FREE((char *) remoteBuf[i]);
} }
} }
free(displayName);
return(-1); return(-1);
} }
cmdPtr = NULL; cmdPtr = NULL;
@ -3499,7 +3505,7 @@ StartClient(
if (!defaultCwd) { if (!defaultCwd) {
if (getenv ("HOME")) if (getenv ("HOME"))
defaultCwd = strdup (getenv ("HOME")); defaultCwd = strndup (getenv("HOME"), MAXPATHLEN);
else else
defaultCwd = getcwd (NULL, MAXPATHLEN + 1); defaultCwd = getcwd (NULL, MAXPATHLEN + 1);