On Wed, Jun 22, 2022 at 11:05:57AM +0200, Geert Stappers via Dnsmasq-discuss 
wrote:
> Because  GCC 12.1 did report:
>   cache.c: In function ‘cache_make_stat’:
>   cache.c:1683:30: warning: pointer used after ‘free’ [-Wuse-after-free]
>    1683 |                 p = new + (p - buff);
>         |                           ~~~^~~~~~~
>   cache.c:1682:17: note: call to ‘free’ here
>    1682 |                 free(buff);
>         |                 ^~~~~~~~~~
> ---
>  src/cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/cache.c b/src/cache.c
> index a99d70d..e221afd 100644
> --- a/src/cache.c
> +++ b/src/cache.c
> @@ -1679,8 +1679,8 @@ int cache_make_stat(struct txt_record *t)
>               if (!(new = whine_malloc(newlen)))
>                 return 0;
>               memcpy(new, buff, bufflen);
> -             free(buff);
>               p = new + (p - buff);
> +             free(buff);
>               lenp = p - 1;
>               buff = new;
>               bufflen = newlen;
> -- 
> 2.11.0
> 
That became 
https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2022q2/016450.html
and this a reminder on it.


Groeten
Geert Stappers
-- 
Silence is hard to parse

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to