Fixed small memory leak in ereport handling

One pre-check in zfs_ereport_start() was being called after
the nvlists were being allocated. This simply corrects that
issue.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #6140
This commit is contained in:
Tom Caputi 2017-05-18 20:35:49 -04:00 committed by Brian Behlendorf
parent a9f0d7dd89
commit a32df59e18

View File

@ -210,6 +210,12 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **detector_out,
(vd->vdev_remove_wanted || vd->vdev_state == VDEV_STATE_REMOVED))
return;
if ((strcmp(subclass, FM_EREPORT_ZFS_DELAY) == 0) &&
(zio != NULL) && (!zio->io_timestamp)) {
/* Ignore bogus delay events */
return;
}
if ((ereport = fm_nvlist_create(NULL)) == NULL)
return;
@ -218,12 +224,6 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **detector_out,
return;
}
if ((strcmp(subclass, FM_EREPORT_ZFS_DELAY) == 0) &&
(zio != NULL) && (!zio->io_timestamp)) {
/* Ignore bogus delay events */
return;
}
/*
* Serialize ereport generation
*/