Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH 13/17: anon funcs: don't leak shf when ctrl-c in () {:} =(sleep 1)



On Tue, 6 Jan 2015 06:25:45 +0100
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> Found by Coverity (Issue 439076).
> ---
>  Src/exec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Src/exec.c b/Src/exec.c
> index 6b93008..207e8c1 100644
> --- a/Src/exec.c
> +++ b/Src/exec.c
> @@ -4461,6 +4461,8 @@ execfuncdef(Estate state, Eprog redir_prog)
>  	    if (htok && args) {
>  		execsubst(args);
>  		if (errflag) {
> +		    zsfree(shf->filename);
> +		    zfree(shf, sizeof(*shf));
>  		    state->pc = end;
>  		    return 1;
>  		}

Can't see how that can be wrong.  Nothing else can take owernship of
shf in the error case.

pws



Messages sorted by: Reverse Date, Date, Thread, Author