Patchwork [PULL,04/17] kvm: Fix potential resource leak (missing fclose)

login
register
mail settings
Submitter Michael Tokarev
Date June 22, 2013, 9:24 a.m.
Message ID <1371893076-9643-5-git-send-email-mjt@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/253397/
State New
Headers show

Comments

Michael Tokarev - June 22, 2013, 9:24 a.m.
From: Stefan Weil <sw@weilnetz.de>

This leak was detected by cppcheck.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i386/kvm/pci-assign.c |    1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index ff85590..1fb7ad4 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -548,6 +548,7 @@  static int get_real_id(const char *devpath, const char *idname, uint16_t *val)
     if (fscanf(f, "%li\n", &id) == 1) {
         *val = id;
     } else {
+        fclose(f);
         return -1;
     }
     fclose(f);