[vdr] 1.3.22: memory leaks

Clemens Kirchgatterer clemens at 1541.org
Sun Mar 27 11:39:33 CEST 2005

s.huelswitt at gmx.de (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.


More information about the vdr mailing list