mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-18 22:15:46 +01:00
Close a memory leak when using zpool_read_all_labels
MFC after: 3 weeks X-MFC-With: 322854 Sponsored by: Spectra Logic Corp
This commit is contained in:
parent
09f3bb8756
commit
76f9ab7444
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323995
@ -101,7 +101,7 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool °raded)
|
||||
poolName = NULL;
|
||||
if (zpool_in_use(g_zfsHandle, devFd, &poolState,
|
||||
&poolName, &b_inuse) == 0) {
|
||||
nvlist_t *devLabel;
|
||||
nvlist_t *devLabel = NULL;
|
||||
|
||||
inUse = b_inuse == B_TRUE;
|
||||
if (poolName != NULL)
|
||||
@ -116,8 +116,10 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool °raded)
|
||||
* might be damaged. In that case, zfsd should do nothing and
|
||||
* wait for the sysadmin to decide.
|
||||
*/
|
||||
if (nlabels != VDEV_LABELS || devLabel == NULL)
|
||||
if (nlabels != VDEV_LABELS || devLabel == NULL) {
|
||||
nvlist_free(devLabel);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
try {
|
||||
Vdev vdev(devLabel);
|
||||
@ -131,6 +133,7 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool °raded)
|
||||
|
||||
exp.GetString().insert(0, context);
|
||||
exp.Log();
|
||||
nvlist_free(devLabel);
|
||||
}
|
||||
}
|
||||
return (NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user