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>
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;