Close XML file handle before error return if fstat() fails
authorDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 26 Sep 2012 19:20:32 +0000 (20:20 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 26 Sep 2012 19:20:35 +0000 (20:20 +0100)
Spotted by Coverity.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
xml.c

diff --git a/xml.c b/xml.c
index 50fe54f..789bdbe 100644 (file)
--- a/xml.c
+++ b/xml.c
@@ -58,6 +58,7 @@ int config_lookup_host(struct openconnect_info *vpninfo, const char *host)
 
        if (fstat(fd, &st)) {
                perror(_("fstat XML config file"));
+               close(fd);
                return -1;
        }