mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-28 08:52:05 +00:00
libsemanage: drop checks on semanage_module_info_destroy() value
semanage_module_info_destroy() always returns 0. Nevertheless semanage_direct_list_all() uses its return value in a surprising way: cleanup: if (priorities != NULL) { /* ... */ free(priorities); } /* ... */ ret = semanage_module_info_destroy(sh, modinfo_tmp); if (ret != 0) { status = -1; goto cleanup; } The last "goto cleanup;" leads clang's static analyzer to believe a double free is possible. Even though this is a false positive, the body of condition "if (ret != 0)" contains dead code. Remove it. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
55b5b7a646
commit
86e6ae67fd
@ -2495,11 +2495,7 @@ static int semanage_direct_list_all(semanage_handle_t *sh,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = semanage_module_info_destroy(sh, modinfo_tmp);
|
||||
if (ret != 0) {
|
||||
status = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
semanage_module_info_destroy(sh, modinfo_tmp);
|
||||
free(modinfo_tmp);
|
||||
modinfo_tmp = NULL;
|
||||
|
||||
@ -2524,11 +2520,7 @@ cleanup:
|
||||
free(modules);
|
||||
}
|
||||
|
||||
ret = semanage_module_info_destroy(sh, modinfo_tmp);
|
||||
if (ret != 0) {
|
||||
status = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
semanage_module_info_destroy(sh, modinfo_tmp);
|
||||
free(modinfo_tmp);
|
||||
modinfo_tmp = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user