mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
vbox: Don't leak virGetUserDirectory()'s output
On vboxStorageVolCreateXML(), virGetUserDirectory() was called without freeing its content later on. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
dd478cc538
commit
ab6de9f04b
@ -410,6 +410,7 @@ vboxStorageVolCreateXML(virStoragePoolPtr pool,
|
||||
resultCodeUnion resultCode;
|
||||
virStorageVolPtr ret = NULL;
|
||||
g_autoptr(virStorageVolDef) def = NULL;
|
||||
g_autofree char *homedir = NULL;
|
||||
|
||||
if (!data->vboxObj)
|
||||
return ret;
|
||||
@ -442,8 +443,10 @@ vboxStorageVolCreateXML(virStoragePoolPtr pool,
|
||||
}
|
||||
|
||||
/* If target.path isn't given, use default path ~/.VirtualBox/image_name */
|
||||
if (!def->target.path)
|
||||
def->target.path = g_strdup_printf("%s/.VirtualBox/%s", virGetUserDirectory(), def->name);
|
||||
if (!def->target.path) {
|
||||
homedir = virGetUserDirectory();
|
||||
def->target.path = g_strdup_printf("%s/.VirtualBox/%s", homedir, def->name);
|
||||
}
|
||||
VBOX_UTF8_TO_UTF16(def->target.path, &hddNameUtf16);
|
||||
|
||||
if (!hddFormatUtf16 || !hddNameUtf16)
|
||||
|
Loading…
Reference in New Issue
Block a user