thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Blob Blame History Raw
From 803bf1ab08aadf547f8e45f0a727c17bb2b96ca5 Mon Sep 17 00:00:00 2001
From: Alex Williamson <alex.williamson@redhat.com>
Date: Fri, 1 Nov 2013 19:50:32 +0100
Subject: [PATCH 02/25] kvm: Fix potential resource leak (missing fclose)

RH-Author: Alex Williamson <alex.williamson@redhat.com>
Message-id: <20131101195032.25461.97296.stgit@bling.home>
Patchwork-id: 55234
O-Subject: [RHEL7 qemu-kvm PATCH 2/3] kvm: Fix potential resource leak (missing fclose)
Bugzilla: 1025877
RH-Acked-by: Bandan Das <bsd@redhat.com>
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>

From: Stefan Weil <sw@weilnetz.de>

Bugzilla: 1025877
Upstream commit: 90527d2a8bb08ca5b4774eacfdd6b8fe9671c077

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(+)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/i386/kvm/pci-assign.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 221a8f7..a5885b4 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);
-- 
1.7.1