diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2015-03-02 12:16:55 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2015-03-02 12:17:27 +0100 |
commit | eeaf3f2e88ef2c664b5cbefb9c9a9e7ada0c752b (patch) | |
tree | f62a85366fd9e7beb01548a79caed1002b414803 | |
parent | 047fe6c59fe2cf3a52208b219caebed469ed6bdc (diff) | |
download | lvm2-eeaf3f2e88ef2c664b5cbefb9c9a9e7ada0c752b.tar.gz |
metadata: vg: add missing vg->lvm1_system_id initialization
The vg->lvm1_systemd_id needs to be initialized as all the code around
counts with that. Just like we initialize lvm1_system_id in vg_create
(no matter if it's actually LVM1 or LVM2 format), this patch adds this
init in alloc_vg as well so the rest of the code does not segfaul
when trying to access vg->lvm1_system_id.
-rw-r--r-- | lib/metadata/vg.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c index 446aa7cff..29936550f 100644 --- a/lib/metadata/vg.c +++ b/lib/metadata/vg.c @@ -57,6 +57,12 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd, dm_list_init(&vg->tags); dm_list_init(&vg->removed_pvs); + if (!(vg->lvm1_system_id = dm_pool_zalloc(vg->vgmem, NAME_LEN + 1))) { + log_error("Failed to allocate VG systemd id."); + dm_pool_destroy(vgmem); + return NULL; + } + log_debug_mem("Allocated VG %s at %p.", vg->name, vg); return vg; |