]> git.proxmox.com Git - qemu.git/commitdiff
qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path
authorMarkus Armbruster <armbru@redhat.com>
Fri, 11 Jan 2013 10:24:59 +0000 (11:24 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 14 Jan 2013 18:07:48 +0000 (12:07 -0600)
Spotted by Coverity.  Also document why we keep it open on success.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/main.c

index 96d3cfa381b2e6464d94ef8d9a50432d3c148060..db281a508be6d6adb3123a31574d4b4328e84604 100644 (file)
@@ -299,10 +299,12 @@ static bool ga_open_pidfile(const char *pidfile)
         goto fail;
     }
 
+    /* keep pidfile open & locked forever */
     return true;
 
 fail:
     unlink(pidfile);
+    close(pidfd);
     return false;
 }
 #else /* _WIN32 */