mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-03 00:37:37 +00:00
libselinux: getconlist: free memory on multiple level arguments
Do not leak memory if the program argument `l` got passed more than once. Found by clang-analyzer. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
d0c02882b7
commit
d0e16077d4
@ -26,6 +26,7 @@ int main(int argc, char **argv)
|
||||
while ((opt = getopt(argc, argv, "l:")) > 0) {
|
||||
switch (opt) {
|
||||
case 'l':
|
||||
free(level);
|
||||
level = strdup(optarg);
|
||||
if (!level) {
|
||||
fprintf(stderr, "memory allocation failure: %d(%s)\n",
|
||||
|
Loading…
Reference in New Issue
Block a user