]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
free tmp after unlinking it
authorWen Congyang <wency@cn.fujitsu.com>
Thu, 31 Mar 2011 03:28:21 +0000 (11:28 +0800)
committerWen Congyang <wency@cn.fujitsu.com>
Fri, 1 Apr 2011 04:15:21 +0000 (12:15 +0800)
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.

src/qemu/qemu_driver.c

index dd12dc8550a4b27dc682308b874a9d048524dcb4..5aa715e1b2d9948c54247b9abd6d4722def9333b 100644 (file)
@@ -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;