218e99
From 803bf1ab08aadf547f8e45f0a727c17bb2b96ca5 Mon Sep 17 00:00:00 2001
218e99
From: Alex Williamson <alex.williamson@redhat.com>
218e99
Date: Fri, 1 Nov 2013 19:50:32 +0100
218e99
Subject: [PATCH 02/25] kvm: Fix potential resource leak (missing fclose)
218e99
218e99
RH-Author: Alex Williamson <alex.williamson@redhat.com>
218e99
Message-id: <20131101195032.25461.97296.stgit@bling.home>
218e99
Patchwork-id: 55234
218e99
O-Subject: [RHEL7 qemu-kvm PATCH 2/3] kvm: Fix potential resource leak (missing fclose)
218e99
Bugzilla: 1025877
218e99
RH-Acked-by: Bandan Das <bsd@redhat.com>
218e99
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
218e99
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
218e99
218e99
From: Stefan Weil <sw@weilnetz.de>
218e99
218e99
Bugzilla: 1025877
218e99
Upstream commit: 90527d2a8bb08ca5b4774eacfdd6b8fe9671c077
218e99
218e99
This leak was detected by cppcheck.
218e99
218e99
Signed-off-by: Stefan Weil <sw@weilnetz.de>
218e99
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
218e99
---
218e99
 hw/i386/kvm/pci-assign.c |    1 +
218e99
 1 file changed, 1 insertion(+)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/i386/kvm/pci-assign.c |    1 +
218e99
 1 files changed, 1 insertions(+), 0 deletions(-)
218e99
218e99
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
218e99
index 221a8f7..a5885b4 100644
218e99
--- a/hw/i386/kvm/pci-assign.c
218e99
+++ b/hw/i386/kvm/pci-assign.c
218e99
@@ -548,6 +548,7 @@ static int get_real_id(const char *devpath, const char *idname, uint16_t *val)
218e99
     if (fscanf(f, "%li\n", &id) == 1) {
218e99
         *val = id;
218e99
     } else {
218e99
+        fclose(f);
218e99
         return -1;
218e99
     }
218e99
     fclose(f);
218e99
-- 
218e99
1.7.1
218e99