Skip to content

Commit

Permalink
efisecdb: do not free optarg
Browse files Browse the repository at this point in the history
The *outfile passed to parse_input_files can only be either set to
optarg or be NULL. optarg should not be free'd and NULL does not need
to.

Since we no longer use on_exit to unlink outfile we also don't need to
set *outfile to NULL.

Fixes commit d917870 (efisecdb: add efisecdb)

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
  • Loading branch information
ncopa committed Jan 28, 2022
1 parent ea680a0 commit 961f19b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/efisecdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ list_guids(void)
* failure.
*/
static int
parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb,
bool dump)
parse_input_files(list_t *infiles, efi_secdb_t **secdb, bool dump)
{
int status = 0;
list_t *pos, *tmp;
Expand Down Expand Up @@ -301,8 +300,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb,
if (!dump)
exit(1);
status = 1;
xfree(*outfile);
*outfile = NULL;
break;
}
}
Expand Down Expand Up @@ -532,7 +529,7 @@ main(int argc, char *argv[])
efi_secdb_set_bool(secdb, EFI_SECDB_SORT_DATA, do_sort_data);
efi_secdb_set_bool(secdb, EFI_SECDB_SORT_DESCENDING, sort_descending);

status = parse_input_files(&infiles, &outfile, &secdb, dump);
status = parse_input_files(&infiles, &secdb, dump);
if (status == 0) {
for_each_action_safe(pos, tmp, &actions) {
action_t *action = list_entry(pos, action_t, list);
Expand Down

0 comments on commit 961f19b

Please sign in to comment.