Hi Christoph,

2016-10-17 20:21 GMT+02:00 Christoph Biedl <debian.a...@manchmal.in-ulm.de>:
> tags 840754 confirmed moreinfo
> thanks
>
> Arnaud Quette wrote...
>
>> ==30967== definitely lost: 48 bytes in 1 blocks
>
> Confirmed, can reproduce this from jessie on, not in wheezy though.
>
>> - Redhat has a similar ticket which they solved:
>> https://bugzilla.redhat.com/show_bug.cgi?id=919466
>
> Unfortunately I fail to see the actual fix for this (and I'm also
> somewhat surprised why it never made upstream, but that's a different
> story).
>
> Since you added the patch tag, do you have some details available?

looking closer at the patch I pointed, it's very probably not suitable.
IMHO, it's Debian related, though I've not tested on Redhat nor others.
As per my original report, the issue is with the return value of
get_default_magic(), which is "/etc/magic" instead of the documented
default "/usr/share/misc/magic" (using "MAGIC=/usr/share/misc/magic
valgrind ./a.out" shows no leak).
Not sure how other distros ships the magic.mgc
Another point is that removing (or renaming) /etc/magic also fixes the issue.

I was not able to hunt the bug yet, but here is some details.
- magic.c->magic_getpath return "/etc/magic:/usr/share/misc/magic"
- the processing of /etc/magic goes fine, but the loops then leak when
processing /usr/share/misc/magic
- the leak happen in apprentice.c->apprentice_1() when calling
add_mlist(). Still not sure why, I don't quite get the deeper logic of
this code.

I'll try to dig more and find a suitable patch, but kids vacations are
on the way in the short run...

again, the simple solution, while waiting for fixing the code, may be
to export MAGIC=/usr/share/misc/magic

Do you want me to remove the patch tag, or do you consider the
"export" solution as being a patch?

cheers,
Arno
-- 
Eaton Data Center Automation Solutions - Opensource Leader
NUT (Network UPS Tools) Project Leader - http://www.networkupstools.org
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.fr

Reply via email to