Your message dated Tue, 6 Mar 2018 22:16:01 +1100
with message-id <>
and subject line Re: libsnmp-python: netsnmp python snmpwalk memory leak
has caused the Debian Bug report #503293,
regarding libsnmp-python: netsnmp python snmpwalk memory leak
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact

Debian Bug Tracking System
Contact with problems
--- Begin Message ---
Package: libsnmp-python
Version: 5.4.1~dfsg-10
Severity: important
Tags: patch

I would like to re-open netsnmp Bug "[ 1868278 ] A bug in python useing 

That's because cited patch ( ) was addressing a seg 

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_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 @@
+  if(varbinds) Py_DECREF(varbinds);
   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, 
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

--- End Message ---
--- Begin Message ---
  This bug report is 10 years old and is for a very old version of
net-snmp. The relevant functions in the python binding have changed and
that part of the code looks like it may have fixed the leak a different

I'll close this bug report, apologies for the delay.

 - Craig

Craig Small          csmall at :
Debian GNU/Linux   csmall at :
Mastodon:               Twitter: @smallsees  
GPG fingerprint:        5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5

--- End Message ---

Reply via email to