Skip to content

Commit

Permalink
Fixed small memory leak in ereport handling
Browse files Browse the repository at this point in the history
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 openzfs#6140
  • Loading branch information
Tom Caputi authored and behlendorf committed May 19, 2017
1 parent a9f0d7d commit a32df59
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions module/zfs/zfs_fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
*/
Expand Down

0 comments on commit a32df59

Please sign in to comment.