Project

General

Profile

Bug #5207

Memory leak in "zfs-diagnosis" (fmd)

Added by Roman Strashkin about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
lib - userland libraries
Start date:
2014-10-03
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

I saw very fast mem leak on a host and after researching core-dump of fmd i prepared the following patch

diff --git a/usr/src/cmd/fm/modules/common/zfs-diagnosis/zfs_de.c b/usr/src/cmd/fm/modules/common/zfs-diagnosis/zfs_de.c
index ba1f276..8fbf630 100644
--- a/usr/src/cmd/fm/modules/common/zfs-diagnosis/zfs_de.c
+++ b/usr/src/cmd/fm/modules/common/zfs-diagnosis/zfs_de.c
@@ -294,17 +294,18 @@ zpool_find_load_time(zpool_handle_t *zhp, void *arg)
        uint64_t *tod;
        nvlist_t *config;
        uint_t nelem;
+       int rc = 0;

        if (lta->lt_found)
-               return (0);
+               goto out;

        pool_guid = zpool_get_prop_int(zhp, ZPOOL_PROP_GUID, NULL);
        if (pool_guid != lta->lt_guid)
-               return (0);
+               goto out;

        if ((config = zpool_get_config(zhp, NULL)) == NULL) {
-               zpool_close(zhp);
-               return (-1);
+               rc = -1;
+               goto out;
        }

        if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_LOADED_TIME,
@@ -314,7 +315,9 @@ zpool_find_load_time(zpool_handle_t *zhp, void *arg)
                lta->lt_time->ertv_nsec = tod[1];
        }

-       return (0);
+out:
+       zpool_close(zhp);
+       return (rc);
 }

 static void


Related issues

Is duplicate of illumos gate - Bug #5519: zfs-diagnosis: Memory leak in zpool_find_load_time()Closed2015-01-09

Actions

History

#1

Updated by Marcel Telka over 4 years ago

  • Status changed from New to Closed

Duplicate of #5519.

Also available in: Atom PDF