diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2015-10-20 14:09:09 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2015-10-30 15:47:55 +0100 |
commit | 097d14e64e845bdb1c0b8106e33f38f775e54fe5 (patch) | |
tree | 0b93925de890e5197c43cb31bb42a352bebd646a /lib/datastruct | |
parent | 17196103e018a34eda016f6bdcd74395210cb114 (diff) | |
download | lvm2-097d14e64e845bdb1c0b8106e33f38f775e54fe5.tar.gz |
str_list: also allow memory allocation without memory pool
Diffstat (limited to 'lib/datastruct')
-rw-r--r-- | lib/datastruct/str_list.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/datastruct/str_list.c b/lib/datastruct/str_list.c index 1d3f08ad1..25ffddd2c 100644 --- a/lib/datastruct/str_list.c +++ b/lib/datastruct/str_list.c @@ -20,7 +20,8 @@ struct dm_list *str_list_create(struct dm_pool *mem) { struct dm_list *sl; - if (!(sl = dm_pool_alloc(mem, sizeof(struct dm_list)))) { + if (!(sl = mem ? dm_pool_alloc(mem, sizeof(struct dm_list)) + : dm_malloc(sizeof(struct dm_list)))) { log_errno(ENOMEM, "str_list allocation failed"); return NULL; } @@ -37,7 +38,8 @@ static int _str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, if (!str) return_0; - if (!(sln = dm_pool_alloc(mem, sizeof(*sln)))) + if (!(sln = mem ? dm_pool_alloc(mem, sizeof(*sln)) + : dm_malloc(sizeof(*sln)))) return_0; sln->str = str; |