]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fixed small memory leak in ereport handling
authorTom Caputi <tcaputi@datto.com>
Fri, 19 May 2017 00:35:49 +0000 (20:35 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 19 May 2017 00:35:49 +0000 (17:35 -0700)
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

module/zfs/zfs_fm.c

index 68c0951f62e433cfcc822c5c17e871ded0f63cde..fedceee19af9ef4182e0220625f85acf55031f2f 100644 (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
         */