]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
network.c:is_wlan() File Leak f
authorWim Coekaerts <wim.coekaerts@oracle.com>
Tue, 29 Dec 2015 06:23:47 +0000 (22:23 -0800)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 4 Jan 2016 17:53:00 +0000 (12:53 -0500)
network.c:is_wlan() File Leak f f initialized at line 156 with fopen f
leaks when fopen(path, r) != NULL at line 156 and physname == NULL at
line 163.

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/network.c

index a6740f56a549e3717a89726eb7098cede1c90f00..269e5e3196310a7c9e7caedd1ea901de6c12733e 100644 (file)
@@ -158,8 +158,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);