policycoreutils: sandbox: seunshare: do not reassign realloc value
We were doing x = realloc(x, ) which is a big no no, since it leaks X on allocation failure. Found with static analysis tool from David Malcolm. Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
parent
709e852aed
commit
0a5dc30456
|
@ -774,10 +774,13 @@ killall (security_context_t execcon)
|
|||
continue;
|
||||
|
||||
if (pids == max_pids) {
|
||||
if (!(pid_table = realloc(pid_table, 2*pids*sizeof(pid_t)))) {
|
||||
pid_t *new_pid_table = realloc(pid_table, 2*pids*sizeof(pid_t));
|
||||
if (!new_pid_table) {
|
||||
free(pid_table);
|
||||
(void)closedir(dir);
|
||||
return -1;
|
||||
}
|
||||
pid_table = new_pid_table;
|
||||
max_pids *= 2;
|
||||
}
|
||||
pid_table[pids++] = pid;
|
||||
|
|
Loading…
Reference in New Issue