From: Wen Congyang Date: Thu, 31 Mar 2011 03:28:21 +0000 (+0800) Subject: free tmp after unlinking it X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e206946;p=libvirt.git free tmp after unlinking it We create a temporary file to save memory, and we will remove it after reading memory to buffer. But we free the variable that contains the temporary filename before we remove it. So we should free tmp after unlinking it. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dd12dc8550..5aa715e1b2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5065,9 +5065,9 @@ endjob: vm = NULL; cleanup: - VIR_FREE(tmp); VIR_FORCE_CLOSE(fd); unlink (tmp); + VIR_FREE(tmp); if (vm) virDomainObjUnlock(vm); return ret;