diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2013-04-21 12:48:24 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2013-04-21 23:10:43 +0200 |
commit | 8f1dd00c3634d111be9a42524ab50b2f31962530 (patch) | |
tree | 95616e3928dd486f944c1533366f78aa812fe623 /libdm/libdm-string.c | |
parent | a2b76a6f022920abd59072decfa7d3d76eeda913 (diff) | |
download | lvm2-8f1dd00c3634d111be9a42524ab50b2f31962530.tar.gz |
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.
Diffstat (limited to 'libdm/libdm-string.c')
-rw-r--r-- | libdm/libdm-string.c | 5 |
1 files changed, 4 insertions, 1 deletions
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))); |