libqos: Allow calling guest_free on NULL pointer

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Fam Zheng 2015-04-24 19:35:17 +08:00 committed by Paolo Bonzini
parent ebe7d8b166
commit 28452758c4

View File

@ -285,6 +285,9 @@ uint64_t guest_alloc(QGuestAllocator *allocator, size_t size)
void guest_free(QGuestAllocator *allocator, uint64_t addr)
{
if (!addr) {
return;
}
mlist_free(allocator, addr);
if (allocator->opts & ALLOC_PARANOID) {
mlist_check(allocator);