Avoid use of free'd memory in auto destroy callback
Avoid use of free'd memory in auto destroy callback

The autodestroy callback code has the following function
called from a hash iterator

  qemuDriverCloseCallbackRun(void *payload,
                             const void *name,
                             void *opaque)
  {
    ...
    char *uuidstr = name
    ...

    dom = closeDef->cb(data->driver, dom, data->conn);
    if (dom)
        virObjectUnlock(dom);

    virHashRemoveEntry(data->driver->closeCallbacks, uuidstr);
  }

The closeDef->cb function may well cause the current callback
to be removed, if it shuts down 'dom'. As such the use of
'uuidstr' in virHashRemoveEntry is accessing free'd memory.
We must make a copy of the uuid str before invoking the
callback to be safe.

Signed-off-by: Daniel P. Berrange <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

siboulet/libvirt-openvz,crobinso/libvirt,trainstack/libvirt,trainstack/libvirt,iam-TJ/libvirt,nertpinx/libvirt,taget/libvirt,cbosdo/libvirt,libvirt/libvirt,eskultety/libvirt,jfehlig/libvirt,datto/libvirt,elmarco/libvirt,andreabolognani/libvirt,agx/libvirt,olafhering/libvirt,nertpinx/libvirt,zhlcindy/libvirt-1.1.4-maintain,andreabolognani/libvirt,datto/libvirt,elmarco/libvirt,rlaager/libvirt,jardasgit/libvirt,rlaager/libvirt,datto/libvirt,shugaoye/libvirt,elmarco/libvirt,olafhering/libvirt,iam-TJ/libvirt,trainstack/libvirt,elmarco/libvirt,olafhering/libvirt,taget/libvirt,shugaoye/libvirt,zippy2/libvirt,iam-TJ/libvirt,cbosdo/libvirt,jfehlig/libvirt,iam-TJ/libvirt,cbosdo/libvirt,VenkatDatta/libvirt,siboulet/libvirt-openvz,eskultety/libvirt,siboulet/libvirt-openvz,siboulet/libvirt-openvz,cbosdo/libvirt,libvirt/libvirt,zippy2/libvirt,shugaoye/libvirt,eskultety/libvirt,crobinso/libvirt,VenkatDatta/libvirt,eskultety/libvirt,jardasgit/libvirt,trainstack/libvirt,shugaoye/libvirt,andreabolognani/libvirt,datto/libvirt,datto/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,fabianfreyer/libvirt,taget/libvirt,agx/libvirt,zhlcindy/libvirt-1.1.4-maintain,andreabolognani/libvirt,fabianfreyer/libvirt,siboulet/libvirt-openvz,agx/libvirt,trainstack/libvirt,VenkatDatta/libvirt,rlaager/libvirt,zhlcindy/libvirt-1.1.4-maintain,rlaager/libvirt,agx/libvirt,trainstack/libvirt,taget/libvirt,cbosdo/libvirt,nertpinx/libvirt,rlaager/libvirt,shugaoye/libvirt,VenkatDatta/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,agx/libvirt,libvirt/libvirt,jardasgit/libvirt,eskultety/libvirt,VenkatDatta/libvirt,andreabolognani/libvirt,crobinso/libvirt,olafhering/libvirt,zhlcindy/libvirt-1.1.4-maintain,zhlcindy/libvirt-1.1.4-maintain,iam-TJ/libvirt,zippy2/libvirt,zippy2/libvirt,jfehlig/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,libvirt/libvirt,taget/libvirt,trainstack/libvirt,iam-TJ/libvirt,iam-TJ/libvirt,jfehlig/libvirt,jardasgit/libvirt,elmarco/libvirt,crobinso/libvirt