Re: trouble with asprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
strings.

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.

-- 
Wolfgang

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux