aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2017-07-26 11:38:17 -0600
committerAlex Williamson <alex.williamson@redhat.com>2017-07-26 11:38:17 -0600
commit418c69813f027cb1408aa2759022f5ca170a8c8c (patch)
tree546d0e5ee90924b8898fde93635f4d5d66df3499
parent522fd24ca030c27c591dafedd65c1dfd51e40450 (diff)
downloadqemu-418c69813f027cb1408aa2759022f5ca170a8c8c.zip
qemu-418c69813f027cb1408aa2759022f5ca170a8c8c.tar.gz
qemu-418c69813f027cb1408aa2759022f5ca170a8c8c.tar.bz2
vfio/platform: fix use of freed memory
free the data _after_ using it. hw/vfio/platform.c:126:29: warning: Use of memory after it is freed qemu_set_fd_handler(*pfd, NULL, NULL, NULL); ^~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r--hw/vfio/platform.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
index 7c09ded..da84abf 100644
--- a/hw/vfio/platform.c
+++ b/hw/vfio/platform.c
@@ -120,11 +120,11 @@ static int vfio_set_trigger_eventfd(VFIOINTp *intp,
*pfd = event_notifier_get_fd(intp->interrupt);
qemu_set_fd_handler(*pfd, (IOHandler *)handler, NULL, intp);
ret = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set);
- g_free(irq_set);
if (ret < 0) {
error_report("vfio: Failed to set trigger eventfd: %m");
qemu_set_fd_handler(*pfd, NULL, NULL, NULL);
}
+ g_free(irq_set);
return ret;
}