libzfsbootenv: lzbe_set_boot_device(): don't free undefined pointer
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #11993
This commit is contained in:
parent
c493943404
commit
87b671f3ac
|
@ -88,12 +88,11 @@ lzbe_set_boot_device(const char *pool, lzbe_flags_t flag, const char *device)
|
||||||
if (strncmp(device, "zfs:", 4) == 0) {
|
if (strncmp(device, "zfs:", 4) == 0) {
|
||||||
fnvlist_add_string(nv, OS_BOOTONCE, device);
|
fnvlist_add_string(nv, OS_BOOTONCE, device);
|
||||||
} else {
|
} else {
|
||||||
descriptor = NULL;
|
if (asprintf(&descriptor, "zfs:%s:", device) > 0) {
|
||||||
if (asprintf(&descriptor, "zfs:%s:", device) > 0)
|
|
||||||
fnvlist_add_string(nv, OS_BOOTONCE, descriptor);
|
fnvlist_add_string(nv, OS_BOOTONCE, descriptor);
|
||||||
else
|
|
||||||
rv = ENOMEM;
|
|
||||||
free(descriptor);
|
free(descriptor);
|
||||||
|
} else
|
||||||
|
rv = ENOMEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue