[OpenWrt-Devel] [PATCH rpcd v2 6/6] main: exec_self: make clang analyzer happy

Petr Štetiar ynezz at true.cz
Tue Oct 22 00:49:14 EDT 2019


Petr Štetiar <ynezz at true.cz> [2019-10-22 06:26:14]:

> Yousong Zhou <yszhou4tech at gmail.com> [2019-10-21 12:59:24]:
> 
> almost happy:
> 
>  main.c:65:1: warning: Potential leak of memory pointed to by 'args'
> 
> diff --git a/main.c b/main.c
> index 12cb4c5c720c..8b11418f1c09 100644
> --- a/main.c
> +++ b/main.c
> @@ -62,6 +62,7 @@ exec_self(int argc, char **argv)
>  
>  	setenv("RPC_HANGUP", "1", 1);
>  	execv(cmd, (char * const *)args);
> +	free(args);
>  }

So I went ahead and I've put some more fixes on top of yours[1] and it's all
green now[2]. I've only compiled test it, so the question is, if it's still
going to work :-)

1. https://gitlab.com/ynezz/openwrt-rpcd/commits/yszhou4tech/memory-issues-fixes
2. https://gitlab.com/ynezz/openwrt-rpcd/pipelines/90432330

-- ynezz

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list