From a2b76a6f022920abd59072decfa7d3d76eeda913 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sun, 21 Apr 2013 12:19:25 +0200 Subject: [PATCH] thin: fix resource leak in err path If the devices list could not have been obtained, FILE* was leaked. --- WHATS_NEW | 1 + daemons/dmeventd/plugins/thin/dmeventd_thin.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index b016b8e13..5d4c7a724 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.99 - =================================== + Fix memleak in dmeventd thin plugin in device list obtaining err path. Add explicit message about unsupported pvmove for thin/thinpool volumes. Fix lvmetad error path in lvmetad_vg_lookup() for null vgname. Fix clvmd _cluster_request() return code in memory fail path. diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c index ba72c4aa2..95ab27a62 100644 --- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c +++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c @@ -246,7 +246,7 @@ static void _umount(struct dm_task *dmt, const char *device) { static const char mountinfo[] = "/proc/self/mountinfo"; static const size_t MINORS = 4096; - FILE *minfo; + FILE *minfo = NULL; char buffer[4096]; char target[PATH_MAX]; struct dm_info info; @@ -288,10 +288,10 @@ static void _umount(struct dm_task *dmt, const char *device) } } - if (fclose(minfo)) +out: + if (minfo && fclose(minfo)) syslog(LOG_ERR, "Failed to close %s\n", mountinfo); -out: if (minors) dm_bitset_destroy(minors); dmeventd_lvm2_lock(); -- 2.43.5