libvirt/src/vmx
Laine Stump b7a92bce07 conf, vmx: check for OOM after calling xmlBufferCreate()
Although libvirt itself uses g_malloc0() and friends, which exit when
there isn't enouogh memory, libxml2 uses standard malloc(), which just
returns NULL on OOM - this means we must check for NULL on return from
any libxml2 functions that allocate memory.

xmlBufferCreate(), for example, might return NULL, and we don't always
check for it. This patch adds checks where it isn't already done.

(NB: Although libxml2 has a provision for changing behavior on OOM (by
calling xmlMemSetup() to change what functions are used to
allocating/freeing memory), we can't use that, since parts of libvirt
code end up in libvirt.so, which is linked and called directly by
applications that may themselves use libxml2 (and may have already set
their own alternate malloc()), e.g. drivers like esx which live totally
in the library rather than a separate process.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-07-04 23:48:34 -04:00
..
Makefile.inc.am maint: Add filetype annotations to Makefile.inc.am 2019-04-12 16:55:38 +02:00
vmx.c conf, vmx: check for OOM after calling xmlBufferCreate() 2020-07-04 23:48:34 -04:00
vmx.h conf: don't use passed in caps in post parse method 2019-12-09 10:15:16 +00:00