mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-28 23:40:35 +00:00
libsemanage: genhomedircon: double free in get_home_dirs
Right before the call to semanage_list_sort() we do some cleanup. Including endpwent(); free(rbuf); semanage_list_destroy(&shells); If the call to the list sort fails we will go to fail: and will do those cleanups a second time. Whoops. Do the list sort before the generic cleanups so the failure code isn't run after the default cleanup. Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
parent
d0c7f6ea4f
commit
e1400f0404
@ -401,11 +401,13 @@ static semanage_list_t *get_home_dirs(genhomedircon_settings_t * s)
|
||||
WARN(s->h_semanage, "Error while fetching users. "
|
||||
"Returning list so far.");
|
||||
}
|
||||
|
||||
if (semanage_list_sort(&homedir_list))
|
||||
goto fail;
|
||||
|
||||
endpwent();
|
||||
free(rbuf);
|
||||
semanage_list_destroy(&shells);
|
||||
if (semanage_list_sort(&homedir_list))
|
||||
goto fail;
|
||||
|
||||
return homedir_list;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user