The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2324

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
In function is_wlan() @ network.c, there is a file handle FILE* f.
There is one exit point in the function where the file handle is not fclose()-ed.

From 0a96cc7e4b330e9351f018568af7d551d567bba4 Mon Sep 17 00:00:00 2001
From: Simos Xenitellis <[email protected]>
Date: Tue, 15 May 2018 00:05:13 +0000
Subject: [PATCH] Fixed resource leak in is_wlan() at network.c

coverity: #1248106

Signed-off-by: Simos Xenitellis <[email protected]>
---
 src/lxc/network.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lxc/network.c b/src/lxc/network.c
index a7e05280d..835a1fb69 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -591,8 +591,10 @@ static char *is_wlan(const char *ifname)
        fseek(f, 0, SEEK_END);
        physlen = ftell(f);
        fseek(f, 0, SEEK_SET);
-       if (physlen < 0)
+       if (physlen < 0) {
+               fclose(f);
                goto bad;
+       }
 
        physname = malloc(physlen + 1);
        if (!physname) {
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to