From 75f8f3ce8b4b2016c477f0f77c90a44597fc9538 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 27 Feb 2012 11:26:25 +0000 Subject: [PATCH] Nicer cleanup of excl_uuid hash Since it on exit path, it's not a big difference, but makes less noise in analyzer and valgrind. --- WHATS_NEW | 1 + daemons/clvmd/clvmd.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 131691799..1f2e2b3c7 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.94 - ==================================== + Add missing cleanup of excl_uuid hash on some exit paths of clvmd. Check for existance of vg_name in _format1/_pool_vg_read(). Fix missing break in _format_pvsegs (2.02.92). Test seg pointer for non-null it in raid_target_percent error path. diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index cb38fc1d6..ea5380b1d 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -345,6 +345,7 @@ int main(int argc, char *argv[]) debug_t debug_arg = DEBUG_OFF; int clusterwide_opt = 0; mode_t old_mask; + int ret = 1; struct option longopts[] = { { "help", 0, 0, 'h' }, @@ -372,7 +373,8 @@ int main(int argc, char *argv[]) case 'S': check_permissions(); - return restart_clvmd(clusterwide_opt)==1?0:1; + ret = (restart_clvmd(clusterwide_opt) == 1) ? 0 : 1; + goto out; case 'C': clusterwide_opt = 1; @@ -402,7 +404,7 @@ int main(int argc, char *argv[]) case 'E': if (!dm_hash_insert(lvm_params.excl_uuid, optarg, optarg)) { fprintf(stderr, "Failed to allocate hash entry\n"); - return 1; + goto out; } break; case 'T': @@ -624,9 +626,11 @@ int main(int argc, char *argv[]) free(delfd); } + ret = 0; +out: dm_hash_destroy(lvm_params.excl_uuid); - return 0; + return ret; } /* Called when the cluster layer has completed initialisation.