mirror of https://gitee.com/openkylin/libvirt.git
virVMXConvertToUTF8: Report non-OOM error on failure of xmlBufferCreateStatic
The function has also non-OOM failure case when the passed string has 0 length, so reporting OOM error is not correct. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
5591ba2889
commit
d877eb1ddc
|
@ -781,12 +781,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!(input = xmlBufferCreateStatic((char *)string, strlen(string)))) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (xmlCharEncInFunc(handler, utf8, input) < 0) {
|
||||
if (!(input = xmlBufferCreateStatic((char *)string, strlen(string))) ||
|
||||
xmlCharEncInFunc(handler, utf8, input) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Could not convert from %s to UTF-8 encoding"), encoding);
|
||||
goto cleanup;
|
||||
|
|
Loading…
Reference in New Issue