1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Always free hash table

also in error path
This commit is contained in:
Zdenek Kabelac 2012-03-23 10:33:26 +00:00
parent 2caa558e7c
commit 0fc9a3dce3
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.96 -
================================
Always free hash table on update_pvid_to_vgid() in lvmetad.
Update and fix monitoring of thin pool devices.
Check hash insert success in lock_vg clvmd.
Check for buffer overwrite in get_cluster_type() clvmd.

View File

@ -622,6 +622,7 @@ static int update_pvid_to_vgid(lvmetad_state *s, struct dm_config_tree *vg,
const char *pvid;
const char *vgid_old;
const char *check_vgid;
int r = 0;
if (!vgid)
return 0;
@ -636,10 +637,10 @@ static int update_pvid_to_vgid(lvmetad_state *s, struct dm_config_tree *vg,
if (nuke_empty &&
(vgid_old = dm_hash_lookup(s->pvid_to_vgid, pvid)) &&
!dm_hash_insert(to_check, vgid_old, (void*) 1))
return 0;
goto out;
if (!dm_hash_insert(s->pvid_to_vgid, pvid, (void*) vgid))
return 0;
goto out;
debug("remap PV %s to VG %s\n", pvid, vgid);
}
@ -652,9 +653,11 @@ static int update_pvid_to_vgid(lvmetad_state *s, struct dm_config_tree *vg,
unlock_vg(s, check_vgid);
}
r = 1;
out:
dm_hash_destroy(to_check);
return 1;
return r;
}
/* A pvid map lock needs to be held if update_pvids = 1. */