OSDN Git Service

ivshmem: Fix fd leak on error
authorAndreas Färber <afaerber@suse.de>
Mon, 15 Sep 2014 16:40:08 +0000 (18:40 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 31 Oct 2014 16:02:14 +0000 (17:02 +0100)
Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/misc/ivshmem.c

index ecef82a..bf585b7 100644 (file)
@@ -512,6 +512,7 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size)
     if (incoming_fd == -1) {
         fprintf(stderr, "could not allocate file descriptor %s\n",
                                                             strerror(errno));
+        close(tmp_fd);
         return;
     }