[Bug 219072] net-mgmt/net-snmp: memory leak in swrun_kinfo.c

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu May 4 19:37:15 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219072

            Bug ID: 219072
           Summary: net-mgmt/net-snmp: memory leak in swrun_kinfo.c
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: zi at FreeBSD.org
          Reporter: mwennrich at gmail.com
             Flags: maintainer-feedback?(zi at FreeBSD.org)
          Assignee: zi at FreeBSD.org

Created attachment 182305
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=182305&action=edit
patch for agent/mibgroup/host/data_access/swrun_kinfo.c

agent/mibgroup/host/data_access/swrun_kinfo.c doesn't check the return code of
CONTAINER_INSERT and leaks memory, if return code is "-1" (duplicate key)

        rc = CONTAINER_INSERT(container, entry);

(rc never gets checked)


This patch checks the return code and frees the allocated entry, if it didn't
get inserted because becaus it was a duplicate.

        if ( -1 == CONTAINER_INSERT(container, entry)) {
          // entry didn't get inserted (duplicate key)
          free(entry);
        }


This resovles this memory leak.

See also upstream bug: https://sourceforge.net/p/net-snmp/bugs/2717/
and upstream submitted patch: https://sourceforge.net/p/net-snmp/patches/1341/

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list