Task #119331 - added.err
back to task #119331download
Error: GCC_ANALYZER_WARNING (CWE-401):
selinux-3.10/sandbox/seunshare.c:753:20: warning[-Wanalyzer-malloc-leak]: leak of ‘new_pid_table’
selinux-3.10/sandbox/seunshare.c:726:12: branch_false: following ‘false’ branch...
selinux-3.10/sandbox/seunshare.c:730:21: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:731:12: branch_false: following ‘false’ branch (when ‘pid_table’ is non-NULL)...
selinux-3.10/sandbox/seunshare.c:736:25: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:737:12: branch_false: following ‘false’ branch...
selinux-3.10/sandbox/seunshare.c:742:33: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:744:12: branch_false: following ‘false’ branch...
selinux-3.10/sandbox/seunshare.c:750:13: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:752:16: branch_true: following ‘true’ branch...
selinux-3.10/sandbox/seunshare.c:753:41: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:752:16: branch_true: following ‘true’ branch...
selinux-3.10/sandbox/seunshare.c:753:41: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:756:20: branch_false: following ‘false’ branch (when ‘pids != max_pids’)...
selinux-3.10/sandbox/seunshare.c:772:27: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:752:16: branch_true: following ‘true’ branch...
selinux-3.10/sandbox/seunshare.c:753:41: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:756:20: branch_true: following ‘true’ branch (when ‘pids == max_pids’)...
selinux-3.10/sandbox/seunshare.c:757:25: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:758:28: branch_false: following ‘false’ branch (when ‘pids < max_pids’)...
selinux-3.10/sandbox/seunshare.c:764:48: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:764:48: acquire_memory: allocated here
selinux-3.10/sandbox/seunshare.c:765:28: branch_false: following ‘false’ branch (when ‘new_pid_table’ is non-NULL)...
selinux-3.10/sandbox/seunshare.c:772:27: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:752:16: branch_true: following ‘true’ branch...
selinux-3.10/sandbox/seunshare.c:753:41: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:753:20: branch_false: following ‘false’ branch...
selinux-3.10/sandbox/seunshare.c:756:20: branch_true: following ‘true’ branch (when ‘pids == max_pids’)...
selinux-3.10/sandbox/seunshare.c:757:25: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:758:28: branch_false: following ‘false’ branch (when ‘pids < max_pids’)...
selinux-3.10/sandbox/seunshare.c:764:48: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:765:28: branch_true: following ‘true’ branch (when ‘new_pid_table’ is NULL)...
selinux-3.10/sandbox/seunshare.c:766:33: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:753:20: danger: ‘new_pid_table’ leaks here; was allocated at [(21)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/20)
# 751| printf("mcs=%s type=%s\n", mcs, type);
# 752| while ((de = readdir (dir)) != NULL) {
# 753|-> if (!(pid = (pid_t)atoi(de->d_name)) || pid == self)
# 754| continue;
# 755|
Error: GCC_ANALYZER_WARNING (CWE-762):
selinux-3.10/sandbox/seunshare.c:764:48: warning[-Wanalyzer-mismatching-deallocation]: ‘pid_table’ should have been deallocated with ‘free’ but was deallocated with ‘reallocarray’
selinux-3.10/sandbox/seunshare.c:726:12: branch_false: following ‘false’ branch...
selinux-3.10/sandbox/seunshare.c:730:21: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:730:21: acquire_memory: allocated here (expects deallocation with ‘free’)
selinux-3.10/sandbox/seunshare.c:731:12: branch_false: following ‘false’ branch (when ‘pid_table’ is non-NULL)...
selinux-3.10/sandbox/seunshare.c:736:25: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:737:12: branch_false: following ‘false’ branch...
selinux-3.10/sandbox/seunshare.c:742:33: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:744:12: branch_false: following ‘false’ branch...
selinux-3.10/sandbox/seunshare.c:750:13: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:752:16: branch_true: following ‘true’ branch...
selinux-3.10/sandbox/seunshare.c:753:41: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:752:16: branch_true: following ‘true’ branch...
selinux-3.10/sandbox/seunshare.c:753:41: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:756:20: branch_false: following ‘false’ branch (when ‘pids != max_pids’)...
selinux-3.10/sandbox/seunshare.c:772:27: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:752:16: branch_true: following ‘true’ branch...
selinux-3.10/sandbox/seunshare.c:753:41: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:756:20: branch_true: following ‘true’ branch (when ‘pids == max_pids’)...
selinux-3.10/sandbox/seunshare.c:757:25: branch_true: ...to here
selinux-3.10/sandbox/seunshare.c:758:28: branch_false: following ‘false’ branch (when ‘pids < max_pids’)...
selinux-3.10/sandbox/seunshare.c:764:48: branch_false: ...to here
selinux-3.10/sandbox/seunshare.c:764:48: danger: deallocated with ‘reallocarray’ here; allocation at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2) expects deallocation with ‘free’
# 762| return -1;
# 763| }
# 764|-> pid_t *new_pid_table = reallocarray(pid_table, max_pids, sizeof(pid_t));
# 765| if (!new_pid_table) {
# 766| free(pid_table);