Skip to content

Commit

Permalink
network.c:is_wlan() File Leak f
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wcoekaer authored and stgraber committed Jan 4, 2016
1 parent a90277d commit ee54ea9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lxc/network.c
Expand Up @@ -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);
Expand Down

0 comments on commit ee54ea9

Please sign in to comment.