[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lxc-devel
Subject:    [lxc-devel] [PATCH] network.c:is_wlan() File Leak f f initialized at line 156 with fopen f leaks whe
From:       wim.coekaerts () oracle ! com
Date:       2015-12-29 6:23:47
Message-ID: 1451370227-11852-1-git-send-email-wim.coekaerts () oracle ! com
[Download RAW message or body]

From: Wim Coekaerts <wim.coekaerts@oracle.com>

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
---
 src/lxc/network.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/lxc/network.c b/src/lxc/network.c
index d4b015d..3417928 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -160,8 +160,10 @@ static char * is_wlan(const char *ifname)
 	physlen = ftell(f);
 	fseek(f, 0, SEEK_SET);
 	physname = malloc(physlen+1);
-	if (!physname)
+	if (!physname) {
+		fclose(f);	
 		goto bad;
+	}
 	memset(physname, 0, physlen+1);
 	ret = fread(physname, 1, physlen, f);
 	fclose(f);
-- 
1.7.1

_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic