]> sourceware.org Git - lvm2.git/commitdiff
coverity: fix mem leak on error path in dm stats
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 11 Feb 2017 20:17:41 +0000 (21:17 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Sun, 12 Feb 2017 16:28:13 +0000 (17:28 +0100)
Free allocated resouces on error path.

libdm/libdm-stats.c

index f68874caea64ea63b0f0fe16e2552910a2be3ca8..032be0391bcaa4a023cb958b1d5313e29548f9fe 100644 (file)
@@ -4842,7 +4842,7 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
                if (!bounds) {
                        log_error("Could not allocate memory for group "
                                  "histogram bounds.");
-                       return NULL;
+                       goto out;
                }
                _stats_copy_histogram_bounds(bounds,
                                             dms->regions[group_id].bounds);
@@ -4869,6 +4869,8 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
 bad:
        _stats_cleanup_region_ids(dms, regions, count);
        dm_free(bounds);
+       dm_free(regions);
+out:
        dm_free((char *) alias);
        return NULL;
 }
This page took 0.042907 seconds and 5 git commands to generate.