]> git.ipfire.org Git - thirdparty/libvirt.git/commit
json: do not call json_tokener_free with NULL
authorJán Tomko <jtomko@redhat.com>
Mon, 4 Nov 2024 07:24:39 +0000 (08:24 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 4 Nov 2024 11:15:10 +0000 (12:15 +0100)
commitfaf6edfa749524721622d5d2159a50814fbbe816
tree7a803f892173e3196fd380ed8cb15e417e97c29d
parent23d78e1c587f3772c3dcfe10b98d590c2fb82651
json: do not call json_tokener_free with NULL

Add an error message for the rare case if json_tokener_new
fails (allocation failure) and guard any use of json_tokener_free
where tok might be NULL (this was possible in libvirt-nss
when the json file could not be opened).

https://gitlab.com/libvirt/libvirt/-/issues/581

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Simon Pilkington
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
src/util/virjson.c
tools/nss/libvirt_nss_leases.c
tools/nss/libvirt_nss_macs.c