[PATCH 04/25] util: validate return from xmlNodeGetContent before use

Ján Tomko jtomko at redhat.com
Thu Jun 25 22:55:41 UTC 2020

On a Wednesday in 2020, Laine Stump wrote:
>There were a few uses of xmlNodeGetContent() that didn't check for
>NULL before using the result.
>A NULL return from xmlNodeGetContent() *could* (probably does) mean
>that there was an Out of Memory condition, but it is unclear from the
>documentation if that is always the case, or if it could just indicate
>a missing value in the document, so we don't report an OOM error, but
>just don't try to use it for, e.g., conversion to an integer.

Is it possible to have an element with "no value"?

Even <wwn/> gives me an empty string instead of NULL.


>Signed-off-by: Laine Stump <laine at redhat.com>
> src/conf/domain_conf.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200626/79ca57a5/attachment-0001.sig>

More information about the libvir-list mailing list