From: Zdenek Kabelac Date: Sun, 21 Apr 2013 10:48:24 +0000 (+0200) Subject: libdm: improve check in dm_split_lvm_name X-Git-Tag: v2_02_99~401 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=8f1dd00c3634d111be9a42524ab50b2f31962530;p=lvm2.git libdm: improve check in dm_split_lvm_name We support both type of call - with or without mem pool. So ensure we will not use NULL vgname also when mem is given. --- diff --git a/libdm/libdm-string.c b/libdm/libdm-string.c index 5ef633435..9d667bb83 100644 --- a/libdm/libdm-string.c +++ b/libdm/libdm-string.c @@ -92,7 +92,10 @@ static char *_unquote(char *component) int dm_split_lvm_name(struct dm_pool *mem, const char *dmname, char **vgname, char **lvname, char **layer) { - if (mem && !(*vgname = dm_pool_strdup(mem, dmname))) + if (mem) + *vgname = dm_pool_strdup(mem, dmname); + + if (!*vgname) return 0; _unquote(*layer = _unquote(*lvname = _unquote(*vgname)));