[libvirt] [PATCH] free tmp after unlinking it

--- src/qemu/qemu_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dd12dc8..5aa715e 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; -- 1.7.1

On Thu, Mar 31, 2011 at 04:23:33PM +0800, Wen Congyang wrote:
--- src/qemu/qemu_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dd12dc8..5aa715e 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;
Houla ! ACK !!! BTW, how did you find this, code review, valgrind or something else ? thanks, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

At 03/31/2011 05:11 PM, Daniel Veillard Write:
On Thu, Mar 31, 2011 at 04:23:33PM +0800, Wen Congyang wrote:
--- src/qemu/qemu_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dd12dc8..5aa715e 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;
Houla ! ACK !!! BTW, how did you find this, code review, valgrind or something else ?
I found this when I was checking all the place that calls qemuDomainObjExitMonitor() /qemuDomainObjExitMonitorWithDriver().
thanks,
Daniel

On Thu, Mar 31, 2011 at 04:23:33PM +0800, Wen Congyang wrote:
--- src/qemu/qemu_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dd12dc8..5aa715e 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;
ACK, but can you write a bit of a longer commit message saying what area of code / method this is fixing, because the diff context is not showing the method name. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

At 03/31/2011 06:49 PM, Daniel P. Berrange Write:
On Thu, Mar 31, 2011 at 04:23:33PM +0800, Wen Congyang wrote:
--- src/qemu/qemu_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dd12dc8..5aa715e 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;
ACK, but can you write a bit of a longer commit message saying what area of code / method this is fixing, because the diff context is not showing the method name.
I added a commit message and pushed it. Thanks.
Daniel
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Wen Congyang