Skip to contentSkip to conversation

kvm: Fix potential resource leak (missing fclose)

PATCH Applied Stefan Weil 2 participants 2 messages Jun 16, 2013 – Jun 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: Fix potential resource leak (missing fclose)

This leak was detected by cppcheck.

---
 hw/i386/kvm/pci-assign.c |    1 +
 1 file changed, 1 insertion(+)
hw/i386/kvm/pci-assign.c +1 -0
index ff85590..1fb7ad4 100644
@@ -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);
Signature · 1 line
1.7.10.4
#1 lore raw

Thanks, applied all of the following:

kvm: Fix potential resource leak (missing fclose)
savevm: Fix potential memory leak
audio: Replace static functions in header file by macros, remove GCC_ATTR
libcacard: Fix cppcheck warning and remove unneeded code

to the trivial patch queue.

/mjt