On Montag, 11. Februar 2008, Ludwig Nussel wrote:
> As you can see it doesn't segfault on asprintf but on free().

I did see that. I did not say it segfaults but it does lead
to segfaults.
> if(asprintf(...) >= 0)
> {
>       printf(...);
>       free(...);
> }

I do not want to change dozens of places like that. Just have
one single point which can emit an error message so I can then
see what has to be done for each individual place. Most of the
asprintf calls will never get into trouble anyway. But if a user
reports a problem I prefer an error message over some vague description.
> Or just use normal snprintf as the amount of charactes to print is
> fixed anyways so you don't need a variable sized buffer.

this is just a minimal sample. The real code has variable length

On Montag, 11. Februar 2008, Ludwig Nussel wrote:
> Even if you use vasprintf to make the function actually work you
> still need to check the return value of vasprintf otherwise this
> wrapper would be kind of useless.

of course. See above.


vdr mailing list

Reply via email to