Re: trouble with asprintf

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

 



Wolfgang Rohdewald wrote:
> 	char *s;
> 	asprintf(&s,"%ld-%.9s",random(),artist.original());
> 
> segfaults only if illegal utf8 chars appear in artist.original()
> 
> asprintf returns -1, so s is nothing that could be freed,
> and this gives a nice backtrace:

So its basically just free'ing an uninitialized pointer.

Well, that leads to the question whether s is unchanged in case of a -1 
error return, and whether this would work:

	char *s = NULL;
	asprintf(&s,"%ld-%.9s",random(),artist.original());

Cheers,

Udo


_______________________________________________
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