Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Utils
KWSys
Commits
3b8fefea
Commit
3b8fefea
authored
Oct 06, 2017
by
Rolf Eike Beer
Browse files
remove pointer checks before calling free()
parent
6d7eb3a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
ProcessUNIX.c
View file @
3b8fefea
...
...
@@ -359,9 +359,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
);
}
...
...
@@ -1514,9 +1512,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
oldForkPIDs
=
cp
->
ForkPIDs
;
cp
->
ForkPIDs
=
(
volatile
pid_t
*
)
malloc
(
sizeof
(
volatile
pid_t
)
*
(
size_t
)(
cp
->
NumberOfCommands
));
if
(
oldForkPIDs
)
{
kwsysProcessVolatileFree
(
oldForkPIDs
);
}
kwsysProcessVolatileFree
(
oldForkPIDs
);
if
(
!
cp
->
ForkPIDs
)
{
return
0
;
}
...
...
@@ -1524,9 +1520,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
cp
->
ForkPIDs
[
i
]
=
0
;
/* can't use memset due to volatile */
}
if
(
cp
->
CommandExitCodes
)
{
free
(
cp
->
CommandExitCodes
);
}
free
(
cp
->
CommandExitCodes
);
cp
->
CommandExitCodes
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
(
size_t
)(
cp
->
NumberOfCommands
));
if
(
!
cp
->
CommandExitCodes
)
{
...
...
ProcessWin32.c
View file @
3b8fefea
...
...
@@ -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
);
}
...
...
@@ -1607,9 +1605,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 +2358,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
)
...
...
testProcess.c
View file @
3b8fefea
...
...
@@ -687,9 +687,7 @@ int main(int argc, const char* argv[])
fflush
(
stdout
);
fflush
(
stderr
);
#if defined(_WIN32)
if
(
argv0
)
{
free
(
argv0
);
}
free
(
argv0
);
#endif
return
r
;
}
else
if
(
argc
>
2
&&
strcmp
(
argv
[
1
],
"0"
)
==
0
)
{
...
...
Brad King
@brad.king
mentioned in commit
efda2a7a
·
Oct 10, 2017
mentioned in commit
efda2a7a
mentioned in commit efda2a7a8f5da0496f0e75953cf675ed4225d24f
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment