diff options
author | KWSys Upstream <kwrobot@kitware.com> | 2017-10-10 12:43:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-10 12:43:35 (GMT) |
commit | c551ff588b48cc4c286922779651890da0f3c22c (patch) | |
tree | df0cfeab5a3ba3f8c41ade690b3ba27bb2c22477 /ProcessWin32.c | |
parent | 4532b0357261af903f86bc29429ae3c9413b54ab (diff) | |
download | CMake-c551ff588b48cc4c286922779651890da0f3c22c.zip CMake-c551ff588b48cc4c286922779651890da0f3c22c.tar.gz CMake-c551ff588b48cc4c286922779651890da0f3c22c.tar.bz2 |
KWSys 2017-10-10 (239bc737)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit 239bc737543886a72c5e9e3445d51e17f7e26abe (master).
Upstream Shortlog
-----------------
Matthias Maennich (5):
6599eda6 testRobustEncoding: restore format flags for std::cout before exiting
862562ce SystemInformation: fix potential off-by-one write
13e02b76 processUNIX: close intermediate file descriptor in error case
73c491e8 processUNIX: fix not null terminated buffer during error reporting
ce55a255 testSystemTools: fix some copy'n'paste issues
Rolf Eike Beer (5):
6ca15069 SystemTools: make Getcwd() more efficient on Windows
6d7eb3a1 CommandLineArguments: do not check variable before delete[]
3b8fefea remove pointer checks before calling free()
cf8beae3 ProcessUNIX: use strdup() instead of open coding it
5d2aff9d ProcessWin32: use strdup() instead of open coding it
Diffstat (limited to 'ProcessWin32.c')
-rw-r--r-- | ProcessWin32.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/ProcessWin32.c b/ProcessWin32.c index 5183e3d..945fa28 100644 --- a/ProcessWin32.c +++ b/ProcessWin32.c @@ -523,9 +523,7 @@ void kwsysProcess_Delete(kwsysProcess* cp) kwsysProcess_SetPipeFile(cp, kwsysProcess_Pipe_STDIN, 0); kwsysProcess_SetPipeFile(cp, kwsysProcess_Pipe_STDOUT, 0); kwsysProcess_SetPipeFile(cp, kwsysProcess_Pipe_STDERR, 0); - if (cp->CommandExitCodes) { - free(cp->CommandExitCodes); - } + free(cp->CommandExitCodes); free(cp->ProcessResults); free(cp); } @@ -713,11 +711,10 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file) *pfile = 0; } if (file) { - *pfile = (char*)malloc(strlen(file) + 1); + *pfile = strdup(file); if (!*pfile) { return 0; } - strcpy(*pfile, file); } /* If we are redirecting the pipe, do not share it or use a native @@ -1607,9 +1604,7 @@ int kwsysProcessInitialize(kwsysProcess* cp) } ZeroMemory(cp->ProcessInformation, sizeof(PROCESS_INFORMATION) * cp->NumberOfCommands); - if (cp->CommandExitCodes) { - free(cp->CommandExitCodes); - } + free(cp->CommandExitCodes); cp->CommandExitCodes = (DWORD*)malloc(sizeof(DWORD) * cp->NumberOfCommands); if (!cp->CommandExitCodes) { return 0; @@ -2362,9 +2357,7 @@ static int kwsysProcess_List__New_NT4(kwsysProcess_List* self) static void kwsysProcess_List__Delete_NT4(kwsysProcess_List* self) { /* Free the process information buffer. */ - if (self->Buffer) { - free(self->Buffer); - } + free(self->Buffer); } static int kwsysProcess_List__Update_NT4(kwsysProcess_List* self) |