Skip to content

Commit

Permalink
libzfsbootenv: lzbe_set_boot_device(): don't free undefined pointer
Browse files Browse the repository at this point in the history
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#11993
  • Loading branch information
nabijaczleweli authored and RageLtMan committed May 31, 2021
1 parent 0fe4c34 commit f575597
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/libzfsbootenv/lzbe_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ lzbe_set_boot_device(const char *pool, lzbe_flags_t flag, const char *device)
if (strncmp(device, "zfs:", 4) == 0) {
fnvlist_add_string(nv, OS_BOOTONCE, device);
} else {
descriptor = NULL;
if (asprintf(&descriptor, "zfs:%s:", device) > 0)
if (asprintf(&descriptor, "zfs:%s:", device) > 0) {
fnvlist_add_string(nv, OS_BOOTONCE, descriptor);
else
free(descriptor);
} else
rv = ENOMEM;
free(descriptor);
}
}

Expand Down

0 comments on commit f575597

Please sign in to comment.