network.c:is_wlan() File Leak f

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>
This commit is contained in:
Wim Coekaerts 2015-12-28 22:23:47 -08:00 committed by Stéphane Graber
parent a90277dfb5
commit ee54ea9a28

View 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);