On Sunday 24 June 2007 23:21:46 Magnus Fromreide wrote:
> On s=F6n, 2007-06-24 at 14:14 +0200, Thomas Anders wrote:
> > Juuso Alasuutari wrote:
> > > The distribution is Debian unstable, libsnmp version is 5.3.1, and
> > > Valgrind is 3.2.3. Is this kind of behavior normal from libsnmp, or is
> > > the test program's code broken in some way?

> >
> > Would you mind building net-snmp 5.4.1.pre3 from source, compile the
> > test program against it and re-run your test?

>
> Using trunk, the memory leak is due to init_snmp_enums where we try to
> add both the string "gauge" and the string "unsigned" to the same key in
> an snmp_enum that is indexed on the ASN.1 type tag.
>
> According to my valgrind that is the definite memory leak.
>
> /MF


This still happens with 5.4.1.rc1.

I investigated this and noticed you're right (although it's the =

strings "uinteger" and "unsigned" that are added to the same key in =

init_snmp_enums, not "gauge" and "unsigned").

Init_snmp_enums calls se_add_pair_to_slist, which in turn calls =

se_add_pair_to_list. Se_add_pair_to_list rejects "unsigned" because key 66 =
is =

already used by "uinteger", and returns SE_ALREADY_THERE. However, there is =

no return value check whatsoever in init_snmp_enums, and so the string will =

leak.

There already exists a friendly reminder in init_snmp_enums that these two =

keys are the same, but why both are still used is beyond me. Since the stri=
ng =

never makes it to the list, wouldn't it be better just to completely remove =

line 761 from snmp_api.c? It worked for me.

J

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders