loader: potential memory leak and check return values
Need to free nvlist before return from vdev_from_nvlist(). Sponsored by: Netflix, Klara Inc.
This commit is contained in:
parent
b865714d95
commit
045f497cbc
@ -1111,14 +1111,20 @@ vdev_from_nvlist(spa_t *spa, uint64_t top_guid, const nvlist_t *nvlist)
|
||||
return (rc);
|
||||
}
|
||||
rc = vdev_init(guid, kids, &vdev);
|
||||
if (rc != 0)
|
||||
if (rc != 0) {
|
||||
nvlist_destroy(kids);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
vdev->v_spa = spa;
|
||||
vdev->v_top = top_vdev;
|
||||
vdev_insert(top_vdev, vdev);
|
||||
|
||||
rc = nvlist_next(kids);
|
||||
if (rc != 0) {
|
||||
nvlist_destroy(kids);
|
||||
return (rc);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
@ -1228,6 +1234,8 @@ vdev_update_from_nvlist(uint64_t top_guid, const nvlist_t *nvlist)
|
||||
vdev_set_initial_state(vdev, kids);
|
||||
|
||||
rc = nvlist_next(kids);
|
||||
if (rc != 0)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
rc = 0;
|
||||
@ -1290,7 +1298,9 @@ vdev_init_from_nvlist(spa_t *spa, const nvlist_t *nvlist)
|
||||
rc = vdev_update_from_nvlist(guid, kids);
|
||||
if (rc != 0)
|
||||
break;
|
||||
nvlist_next(kids);
|
||||
rc = nvlist_next(kids);
|
||||
if (rc != 0)
|
||||
break;
|
||||
}
|
||||
nvlist_destroy(kids);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user