1.3.22: memory leaks

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

 



s.huelswitt@xxxxxx (Stefan Huelswitt) wrote:

> Second is in epg.c tComponent::FromString(). I cannot find
> anything bad with the code there, but valgrind reports a lot of
> memory leaks with the sscanf() call. So I guessed that sscanf() is
> leaking internaly when used with "%a[\n]" (at least with my glibc
> version 2.2.5). After changing to code to the suggestion below,
> the leaks disappeared:

from man sscanf:

a	Indicates  that  the  conversion  will be s, the needed
	memory space for the string will be malloc'ed  and the
	pointer to  it will  be assigned to the char pointer
	variable, which does not have to be initialized before. 

so, yes, the user is responsible for freeing memory allocated by sscanf.

clemens


[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