Package: libsnmp-python Version: 5.4.1~dfsg-10 Severity: important Tags: patch
Hi, I would like to re-open netsnmp Bug "[ 1868278 ] A bug in python useing netsnmp.snmpwalk". That's because cited patch ( http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=497656 ) was addressing a seg fault. I did some tests in order to find the memory leak, I hope it can be avoided by applying the following patch: --- python/netsnmp/client_intf.c +++ python/netsnmp/client_intf.c @@ -1778,7 +1778,7 @@ PyObject *varlist; PyObject *varbind; PyObject *val_tuple = NULL; - PyObject *varbinds; + PyObject *varbinds = NULL; int varlist_len = 0; int varlist_ind; netsnmp_session *ss; @@ -2003,14 +2003,13 @@ (len ? Py_BuildValue("s#", str_buf, len) : Py_BuildValue(""))); - Py_DECREF(varbind); - } else { /* Return None for this variable. */ _PyTuple_Resize(&val_tuple, result_count+1); PyTuple_SetItem(val_tuple, result_count++, Py_BuildValue("")); printf("netsnmp_walk: bad varbind (%d)\n", varlist_ind); } + if(varbind) Py_DECREF(varbind); } /* reuse the response as the next pdu to send */ pdu = snmp_pdu_create(SNMP_MSG_GETNEXT); @@ -2036,6 +2035,7 @@ } done: + if(varbinds) Py_DECREF(varbinds); SAFE_FREE(oid_arr); return (val_tuple ? val_tuple : Py_BuildValue("")); } I'm not experienced with Python C API but I think the root cause was a missing Py_DECREF on some PyObjects. I suggest to test the patch to verify it is not breaking anything. Thanks and Regards. Gabriele Messineo -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.18-6-xen-686 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libsnmp-python depends on: ii libc6 2.7-15 GNU C Library: Shared libraries ii libsnmp15 5.4.1~dfsg-10 SNMP (Simple Network Management Pr ii python 2.5.2-2 An interactive high-level object-o ii python-central 0.6.8 register and build utility for Pyt libsnmp-python recommends no packages. libsnmp-python suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]