Hi Tom,

Indeed, I overlooked this.

Thanks for the help!

On Mon, 17 Sep 2018 at 12:24, Tom Hughes <t...@compton.nu> wrote:

> On 17/09/2018 10:16, Mohamed BELAOUAD wrote:
>
> > I seem to have encountered a false positive with valgrind-3.13.0 with
> > the program below.
> > https://pastebin.com/XPHsM2sF
> >
> > Valgrind gives "invalid read" errors show the following pastebin:
> > https://pastebin.com/a4vzNMvW.
> >
> > The error is reported during the second call to w_strdup_printf on
> > address of string a (which is created during the first call).
> > If I uncomment the printf calls, the errors disappear. If I move free(a)
> > next to free(b), the errors also disappear.
> >
> > I am not sure if I am missing something in my program or if those are
> > real false positives.
>
> You have used ap twice, the second time after va_end.
>
> I think you meant to pass ap_copy to the vsnprintf calls (and to
> the va_end calls).
>
> Tom
>
> --
> Tom Hughes (t...@compton.nu)
> http://compton.nu/
>
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to