diff --git a/ProcessUNIX.c b/ProcessUNIX.c index 241e2957380bb4dfb5b21621fdaf38905aa84c84..ca9d424289472e5d4de6d6f3fd4585ee4915f751 100644 --- a/ProcessUNIX.c +++ b/ProcessUNIX.c @@ -68,6 +68,7 @@ do. #include <signal.h> /* sigaction */ #include <dirent.h> /* DIR, dirent */ #include <ctype.h> /* isspace */ +#include <assert.h> /* assert */ #if defined(__VMS) # define KWSYSPE_VMS_NONBLOCK , O_NONBLOCK @@ -450,6 +451,7 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command) } for(i=0; i < n; ++i) { + assert(command[i]); /* Quiet Clang scan-build. */ newCommands[cp->NumberOfCommands][i] = strdup(command[i]); if(!newCommands[cp->NumberOfCommands][i]) { diff --git a/testCommandLineArguments1.cxx b/testCommandLineArguments1.cxx index 3b84c38cdc08ad1f98f767f6c95a15cbd237f635..b65c37f85cead2d8edfd5ba1e8f1a2148a8423c6 100644 --- a/testCommandLineArguments1.cxx +++ b/testCommandLineArguments1.cxx @@ -21,6 +21,7 @@ # include "kwsys_ios_iostream.h.in" #endif +#include <assert.h> /* assert */ #include <string.h> /* strcmp */ int testCommandLineArguments1(int argc, char* argv[]) @@ -83,6 +84,7 @@ int testCommandLineArguments1(int argc, char* argv[]) } for ( cc = 0; cc < newArgc; ++ cc ) { + assert(newArgv[cc]); /* Quiet Clang scan-build. */ kwsys_ios::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]" << kwsys_ios::endl; if ( cc >= 9 ) diff --git a/testProcess.c b/testProcess.c index 3d62822488d26222504694e69c58a31276fa8c68..47c3fb0d054e7a5919c1c5d904edf12c1c408aed 100644 --- a/testProcess.c +++ b/testProcess.c @@ -20,6 +20,7 @@ # include "Encoding.h.in" #endif +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -104,6 +105,7 @@ static int test4(int argc, const char* argv[]) fprintf(stderr, "Output before crash on stderr from crash test.\n"); fflush(stdout); fflush(stderr); + assert(invalidAddress); /* Quiet Clang scan-build. */ /* Provoke deliberate crash by writing to the invalid address. */ *invalidAddress = 0; fprintf(stdout, "Output after crash on stdout from crash test.\n");