Skip to content

Commit

Permalink
fix(dracut-install): memory leak
Browse files Browse the repository at this point in the history
"Error: RESOURCE_LEAK (CWE-772):
src/install/dracut-install.c:1135: alloc_fn: Storage is returned from allocation function ""strv_split"".
src/install/dracut-install.c:1135: var_assign: Assigning: ""firmwaredirs"" = storage returned from ""strv_split(optarg, "":"")"".
src/install/dracut-install.c:1135: overwrite_var: Overwriting ""firmwaredirs"" in ""firmwaredirs = strv_split(optarg, "":"")"" leaks the storage that ""firmwaredirs"" points to.
 1133|                           break;
 1134|                   case ARG_FIRMWAREDIRS:
 1135|->                         firmwaredirs = strv_split(optarg, "":"");
 1136|                           break;
 1137|                   case 'f':"
  • Loading branch information
lnykryn committed Mar 6, 2024
1 parent 7bc7bbc commit 403c2a8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/install/dracut-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ static int parse_argv(int argc, char *argv[])
kerneldir = optarg;
break;
case ARG_FIRMWAREDIRS:
strv_free(firmwaredirs);
firmwaredirs = strv_split(optarg, ":");
break;
case 'f':
Expand Down

0 comments on commit 403c2a8

Please sign in to comment.