mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
vbox: abort() on allocation failure in UTF8<->UTF16 conversion
Trying to report an error on OOM is pointless since error handling allocates memory. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
695d469238
commit
3fdf0013e5
@ -5465,17 +5465,9 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
|
||||
}
|
||||
|
||||
VBOX_UTF8_TO_UTF16(def->parent.name, &name);
|
||||
if (!name) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (def->parent.description) {
|
||||
VBOX_UTF8_TO_UTF16(def->parent.description, &description);
|
||||
if (!description) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
rc = gVBoxAPI.UIConsole.TakeSnapshot(console, name, description, &progress);
|
||||
@ -6475,10 +6467,6 @@ vboxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
|
||||
goto cleanup;
|
||||
}
|
||||
VBOX_UTF16_TO_UTF8(nameUtf16, &name);
|
||||
if (!name) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = virGetDomainSnapshot(dom, name);
|
||||
|
||||
@ -6533,10 +6521,6 @@ vboxDomainSnapshotCurrent(virDomainPtr dom, unsigned int flags)
|
||||
}
|
||||
|
||||
VBOX_UTF16_TO_UTF8(nameUtf16, &name);
|
||||
if (!name) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = virGetDomainSnapshot(dom, name);
|
||||
|
||||
@ -6593,10 +6577,6 @@ static int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
||||
}
|
||||
|
||||
VBOX_UTF16_TO_UTF8(nameUtf16, &name);
|
||||
if (!name) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = STREQ(snapshot->name, name);
|
||||
|
||||
|
@ -391,8 +391,19 @@ typedef nsISupports IKeyboard;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define VBOX_UTF16_TO_UTF8(arg1, arg2) gVBoxAPI.UPFN.Utf16ToUtf8(data->pFuncs, arg1, arg2)
|
||||
#define VBOX_UTF8_TO_UTF16(arg1, arg2) gVBoxAPI.UPFN.Utf8ToUtf16(data->pFuncs, arg1, arg2)
|
||||
#define VBOX_UTF16_TO_UTF8(arg1, arg2) \
|
||||
do { \
|
||||
gVBoxAPI.UPFN.Utf16ToUtf8(data->pFuncs, arg1, arg2); \
|
||||
if (!*(arg2)) \
|
||||
abort(); \
|
||||
} while (0)
|
||||
|
||||
#define VBOX_UTF8_TO_UTF16(arg1, arg2) \
|
||||
do { \
|
||||
gVBoxAPI.UPFN.Utf8ToUtf16(data->pFuncs, arg1, arg2); \
|
||||
if (!*(arg2)) \
|
||||
abort(); \
|
||||
} while (0)
|
||||
|
||||
#define VBOX_ADDREF(arg) gVBoxAPI.nsUISupports.AddRef((void *)(arg))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user