mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-16 17:46:54 +00:00
libsemanage: fix memory leak in semanage_user_roles
The output parameter `role_arr` of semanage_user_get_roles() is an array of non-owned role names. Since the array is never used again, as its contents have been copied into the return value `roles`, free it. Example leak report from useradd(8): Direct leak of 8 byte(s) in 1 object(s) allocated from: #0 0x5597624284a8 in __interceptor_calloc (./shadow/src/useradd+0xee4a8) #1 0x7f53aefcbbf9 in sepol_user_get_roles src/user_record.c:270:21
This commit is contained in:
parent
b5dffcd9a1
commit
3be312e0cf
@ -47,6 +47,7 @@ static char *semanage_user_roles(semanage_handle_t * handle, const char *sename)
|
||||
}
|
||||
}
|
||||
}
|
||||
free(roles_arr);
|
||||
}
|
||||
semanage_user_free(user);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user