svn commit: r362883 - head/stand/libsa/zfs
Toomas Soome
tsoome at FreeBSD.org
Thu Jul 2 07:03:16 UTC 2020
Author: tsoome
Date: Thu Jul 2 07:03:15 2020
New Revision: 362883
URL: https://svnweb.freebsd.org/changeset/base/362883
Log:
loader: potential memory leak and check return values
Need to free nvlist before return from vdev_from_nvlist().
Sponsored by: Netflix, Klara Inc.
Modified:
head/stand/libsa/zfs/zfsimpl.c
Modified: head/stand/libsa/zfs/zfsimpl.c
==============================================================================
--- head/stand/libsa/zfs/zfsimpl.c Thu Jul 2 01:10:18 2020 (r362882)
+++ head/stand/libsa/zfs/zfsimpl.c Thu Jul 2 07:03:15 2020 (r362883)
@@ -1111,14 +1111,20 @@ vdev_from_nvlist(spa_t *spa, uint64_t top_guid, const
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 nvlis
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 *nvli
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);
More information about the svn-src-head
mailing list