]> git.ipfire.org Git - thirdparty/libvirt.git/commit
debug: avoid null dereference on uuid lookup api
authorEric Blake <eblake@redhat.com>
Mon, 6 Jun 2011 17:55:43 +0000 (11:55 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 8 Jun 2011 11:28:20 +0000 (05:28 -0600)
commit2ed0c94dbc073f280a3758b90940018e04a76bcc
tree6d8a24cc21c8341276e55af9f3cc7c93d3673f2f
parentf73198df3b9ee2e3cca20e7aa7e75fe191dac7f6
debug: avoid null dereference on uuid lookup api

Detected by Coverity.  Commit a98d8f0d tried to make uuid debugging
more robust, but missed some APIs.  And on the APIs that it visited,
the mere act of preparing the debug message ends up dereferencing
uuid prior to the null check.  Which means the APIs which are supposed
to gracefully reject NULL arguments now end up with SIGSEGV.

* src/libvirt.c (VIR_UUID_DEBUG): New macro.
(virDomainLookupByUUID, virDomainLookupByUUIDString)
(virNetworkLookupByUUID, virNetworkLookupByUUIDString)
(virStoragePoolLookupByUUID, virStoragePoolLookupByUUIDString)
(virSecretLookupByUUID, virSecretLookupByUUIDString)
(virNWFilterLookupByUUID, virNWFilterLookupByUUIDString): Avoid
null dereference.
src/libvirt.c