[lldp-devel] [PATCH] Avoid possible resource leaks

John Fastabend john.r.fastabend at intel.com
Tue Aug 16 01:13:35 UTC 2011


On 8/14/2011 11:56 PM, Petr Sabata wrote:
> This patch prevents possible resource leaks in mand_clif_cmd().
> 
> Signed-off-by: Petr Sabata <contyk at redhat.com>
> ---
>  lldp_mand_cmds.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/lldp_mand_cmds.c b/lldp_mand_cmds.c
> index d09d6a5..264d836 100644
> --- a/lldp_mand_cmds.c
> +++ b/lldp_mand_cmds.c
> @@ -492,8 +492,11 @@ int mand_clif_cmd(void  *data,
>  
>  	/* Confirm port is a lldpad managed port */
>  	port = port_find_by_name(cmd.ifname);
> -	if (!port)
> +	if (!port) {
> +		free(argvals);
> +		free(args);
>  		return cmd_device_not_found;
> +	}
>  
>  	switch (cmd.cmd) {
>  	case cmd_getstats:

Applied good catch thanks!



More information about the lldp-devel mailing list