1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-26 03:22:12 +03:00

Chheck for failing filename strdup

This commit is contained in:
Zdenek Kabelac 2011-09-25 19:39:38 +00:00
parent f45106b726
commit 354a2a6769

View File

@ -127,8 +127,13 @@ struct dm_config_tree *dm_config_create(const char *filename, int keep_open)
c->exists = 0; c->exists = 0;
c->keep_open = keep_open; c->keep_open = keep_open;
c->custom = NULL; c->custom = NULL;
if (filename) if (filename &&
c->filename = dm_pool_strdup(c->mem, filename); !(c->filename = dm_pool_strdup(c->mem, filename))) {
log_error("Failed to duplicate filename.");
dm_pool_destroy(mem);
return 0;
}
return &c->cft; return &c->cft;
} }