From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16219 invoked by alias); 27 Feb 2012 10:10:44 -0000 Received: (qmail 16202 invoked by uid 9737); 27 Feb 2012 10:10:43 -0000 Date: Mon, 27 Feb 2012 10:10:00 -0000 Message-ID: <20120227101043.16200.qmail@sourceware.org> From: zkabelac@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/daemons/lvmetad lvmetad-core.c Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00194.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-02-27 10:10:43 Modified files: daemons/lvmetad: lvmetad-core.c Log message: Move allocation after check for vgid so there is no mem leak on this error path. Also actually check if the hash exists. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/lvmetad/lvmetad-core.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43 --- LVM2/daemons/lvmetad/lvmetad-core.c 2012/02/24 00:24:37 1.42 +++ LVM2/daemons/lvmetad/lvmetad-core.c 2012/02/27 10:10:43 1.43 @@ -548,7 +548,7 @@ const char *vgid, int nuke_empty) { struct dm_config_node *pv = pvs(vg->root); - struct dm_hash_table *to_check = dm_hash_create(32); + struct dm_hash_table *to_check; struct dm_hash_node *n; const char *pvid; const char *vgid_old; @@ -556,6 +556,9 @@ if (!vgid) return 0; + if (!(to_check = dm_hash_create(32))) + return 0; + while (pv) { pvid = dm_config_find_str(pv->child, "id", NULL); vgid_old = dm_hash_lookup(s->pvid_to_vgid, pvid);