Skip to contentSkip to conversation

master - libdm: fix resource leak in dm_stats_set_alias()

PATCH Bryn Reeves 1 participant 1 message Jul 8, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=059a383cf8d3198ba6c77a18cea09c4a0a40032a
Commit:        059a383cf8d3198ba6c77a18cea09c4a0a40032a
Parent:        5e06b33c51e2b264ad8a48b61f18bf3bff37c992
Author:        Bryn M. Reeves <[email protected]>
AuthorDate:    Fri Jul 8 10:51:19 2016 +0100
Committer:     Bryn M. Reeves <[email protected]>
CommitterDate: Fri Jul 8 11:14:29 2016 +0100

libdm: fix resource leak in dm_stats_set_alias()

When we fail to update aux_data the newly allocated group->alias must be freed before reinstating old_alias.

---
 libdm/libdm-stats.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
libdm/libdm-stats.c +1 -0
index e979b34..d89f77a 100644
@@ -3106,6 +3106,7 @@ int dm_stats_set_alias(struct dm_stats *dms, uint64_t group_id, const char *alia
 	return 1;
 
 bad:
+	dm_free((char *) group->alias);
 	group->alias = old_alias;
 	return 0;
 }