[lxc-devel] [PATCH] 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.
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Jan 4 17:49:36 UTC 2016
Quoting wim.coekaerts at oracle.com (wim.coekaerts at oracle.com):
> From: Wim Coekaerts <wim.coekaerts at oracle.com>
>
> Signed-off-by: Wim Coekaerts <wim.coekaerts at oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.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 at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list