On 27 Mar 2005 Clemens Kirchgatterer clemens@1541.org wrote:
s.huelswitt@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.
Yes, of course. I can read man pages ;)
This is not what I'm talking about. The malloc memory is free'd by VDR, but there is still some memory leaked. I think it's internaly lost. This can be proven with my patch. If the %a[ is obmitted, there is no leak.
Regards.