From a32df59e187a6187eb96c52b93cf02e8af51f327 Mon Sep 17 00:00:00 2001 From: Tom Caputi Date: Thu, 18 May 2017 20:35:49 -0400 Subject: [PATCH] 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 Reviewed-by: Giuseppe Di Natale Reviewed-by: Brian Behlendorf Signed-off-by: Tom Caputi Closes #6140 --- module/zfs/zfs_fm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/module/zfs/zfs_fm.c b/module/zfs/zfs_fm.c index 68c0951f6..fedceee19 100644 --- a/module/zfs/zfs_fm.c +++ b/module/zfs/zfs_fm.c @@ -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 */ -- 2.40.0