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

libdm: check for null from pool strdup

Unlikely to happen, but Coverity shown we may have possible
derefer NULL pointer.
This commit is contained in:
Zdenek Kabelac 2015-11-16 00:00:32 +01:00
parent 422c7474ca
commit d4288c9bdf
2 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.111 -
====================================
Add missing check for allocation inside dm_split_lvm_name().
Test dm_task_get_message_response for !NULL in dm_stats_print_region().
Add checks for failing dm_stats_create() in dmsetup.
Add missing fifo close when failed to initialize client connection.

View File

@ -95,8 +95,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))) {
log_error("Failed to duplicate dmname.");
return 0;
}
if (!*vgname)
return 0;