]> git.ipfire.org Git - thirdparty/libvirt.git/commit
tests: Fix logic to not have possible NULL deref
authorJohn Ferlan <jferlan@redhat.com>
Sun, 3 Nov 2019 12:55:21 +0000 (07:55 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 6 Nov 2019 16:27:12 +0000 (11:27 -0500)
commit3f3f74dbc755a09c161069967fc84e860edcd262
treeb7d0d93479b3f16fa0af9a24d779b0c34632b365
parent77180d0f703c60ea511a695c12a4f49f186531e2
tests: Fix logic to not have possible NULL deref

It's possible that virBitmapNewString returns NULL with an error
string (and not an allocation failure that would abort); however, if
virBitmapToString is called with a NULL @bitmap, then it will fail
in an ugly manner. So rather than have if (!map && !str) logic, split
the checks for each variable.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
tests/virbitmaptest.c