[PATCH 3/5] dmxVDLRead: if we opened a file, close it instead of leaking it

Alan Coopersmith alan.coopersmith at oracle.com
Sun Feb 10 12:39:34 PST 2013


Reported with other leaks found by cppcheck in bugzilla #50281
https://bugs.freedesktop.org/show_bug.cgi?id=50281

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 hw/dmx/config/dmxcompat.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/dmx/config/dmxcompat.c b/hw/dmx/config/dmxcompat.c
index bd9f127..107991a 100644
--- a/hw/dmx/config/dmxcompat.c
+++ b/hw/dmx/config/dmxcompat.c
@@ -228,5 +228,9 @@ dmxVDLRead(const char *filename)
             break;
         }
     }
+
+    if (str != stdin)
+        fclose(str);
+
     return entry;
 }
-- 
1.7.9.2



More information about the xorg-devel mailing list