File 03dc9982-fix-deallocation.patch of Package vhostmd.8333

commit 03dc99825ad3d53cfcc7d8c2b8288b1549f261d6
Author: Michael Trapp <Michael.Trapp@sap.com>
Date:   Thu Jun 21 15:19:26 2018 +0200

    fix deallocation in vu_vm_free
    
    Callers of vu_vm_free may pass a partially constructed vu_vm
    object. Check if members of the object have been allocated
    before deallocating them.

Index: vhostmd-0.4/vhostmd/virt-util.c
===================================================================
--- vhostmd-0.4.orig/vhostmd/virt-util.c
+++ vhostmd-0.4/vhostmd/virt-util.c
@@ -118,15 +118,17 @@ vu_vm *vu_get_vm(int id)
 
  error:
    virDomainFree(dom);
-   free(vm);
+   vu_vm_free(vm);
    return NULL;
 }
 
 void vu_vm_free(vu_vm *vm)
 {
    if (vm) {
-      free(vm->name);
-      free(vm->uuid);
+      if (vm->name)
+         free(vm->name);
+      if (vm->uuid)
+         free(vm->uuid);
       free(vm);
    }
 }