From: Jon Trulson Date: Sun, 28 Dec 2014 01:19:55 +0000 (-0700) Subject: dtsession/SmRestore: fixup 8 coverity issues. X-Git-Tag: 2.2.3~60^2~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a657f302f7e07bbb6526ec4dd5823ac9ec0e812a;p=oweals%2Fcde.git dtsession/SmRestore: fixup 8 coverity issues. --- diff --git a/cde/programs/dtsession/SmRestore.c b/cde/programs/dtsession/SmRestore.c index 30204800..1f556b46 100644 --- a/cde/programs/dtsession/SmRestore.c +++ b/cde/programs/dtsession/SmRestore.c @@ -590,7 +590,7 @@ RestoreState( void ) fileSize = MAXLINE + 1; } - line = (unsigned char *) malloc ((fileSize + 1) * sizeof(char *)); + line = malloc(fileSize + 1); if (line == NULL) { line = fallBackLine; @@ -828,6 +828,8 @@ RestoreResources( Boolean errorHandlerInstalled, ... ) char *argv[20]; va_list args; +#if 0 + /* JET - this seems like a bad (and unused) idea */ /* * Check for alternate resource loader. */ @@ -835,6 +837,9 @@ RestoreResources( Boolean errorHandlerInstalled, ... ) { 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 @@ -1286,7 +1291,7 @@ RestoreSettings( void ) ptrSize += 50; restorePtrArray = (char **)SM_REALLOC((char *) restorePtrArray, ptrSize * - sizeof(char **)); + sizeof(char *)); if(restorePtrArray == NULL) { PrintErrnoError(DtError, smNLS.cantMallocErrorString); @@ -2065,6 +2070,7 @@ RestoreClients( void ) SM_FREE((char *) remoteBuf[i]); } } + free(displayName); return(-1); } cmdPtr = NULL; @@ -3499,7 +3505,7 @@ StartClient( if (!defaultCwd) { if (getenv ("HOME")) - defaultCwd = strdup (getenv ("HOME")); + defaultCwd = strndup (getenv("HOME"), MAXPATHLEN); else defaultCwd = getcwd (NULL, MAXPATHLEN + 1);