public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/13316] New: (cpychecker) Suspected memory leak in gdb/python/py-param.c: compute_enum_values
@ 2011-10-18 14:33 dmalcolm at redhat dot com
  2011-10-24 11:42 ` [Bug python/13316] " pmuldoon at redhat dot com
  2013-11-01 18:01 ` tromey at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dmalcolm at redhat dot com @ 2011-10-18 14:33 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13316

             Bug #: 13316
           Summary: (cpychecker) Suspected memory leak in
                    gdb/python/py-param.c: compute_enum_values
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dmalcolm@redhat.com
    Classification: Unclassified


Created attachment 6018
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6018
HTML report showing the execution paths that leak memory

See the attached HTML report from gcc-python-plugin's cpychecker.

It looks like a reference count on "*item" is leaked for each time through the
loop in compute_enum_values().

Reading 
  http://docs.python.org/c-api/sequence.html#PySequence_GetItem

a successful call to PySequence_GetItem() is meant to give the caller ownership
of a reference count on the returned PyObject*

Double-checking with Python's Objects/abstract.c:
  PyObject *
  PySequence_GetItem(PyObject *s, Py_ssize_t i)
  {
        [... setup and error handling ...]
        return m->sq_item(s, i);
  }

and looking at e.g. Objects/listobject.c: list_item (the sq_item callback for
PyList_Type): it Py_INCREFs the returned item.

Hence I believe that cpychecker is correctly reporting a memory leak here (for
both the case of a successful execution of compute_enum_values(), and the
failure path it shows).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug python/13316] (cpychecker) Suspected memory leak in gdb/python/py-param.c: compute_enum_values
  2011-10-18 14:33 [Bug python/13316] New: (cpychecker) Suspected memory leak in gdb/python/py-param.c: compute_enum_values dmalcolm at redhat dot com
@ 2011-10-24 11:42 ` pmuldoon at redhat dot com
  2013-11-01 18:01 ` tromey at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pmuldoon at redhat dot com @ 2011-10-24 11:42 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13316

Phil Muldoon <pmuldoon at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pmuldoon at redhat dot com
         AssignedTo|unassigned at sourceware    |pmuldoon at redhat dot com
                   |dot org                     |

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug python/13316] (cpychecker) Suspected memory leak in gdb/python/py-param.c: compute_enum_values
  2011-10-18 14:33 [Bug python/13316] New: (cpychecker) Suspected memory leak in gdb/python/py-param.c: compute_enum_values dmalcolm at redhat dot com
  2011-10-24 11:42 ` [Bug python/13316] " pmuldoon at redhat dot com
@ 2013-11-01 18:01 ` tromey at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at redhat dot com @ 2013-11-01 18:01 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13316

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |tromey at redhat dot com
         Resolution|---                         |FIXED
   Target Milestone|---                         |7.7

--- Comment #1 from Tom Tromey <tromey at redhat dot com> ---
I fixed this a while back without realizing there was a PR:

2013-05-20  Tom Tromey  <tromey@redhat.com>

    * python/py-param.c (compute_enum_values): Decref 'item'.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-01 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-18 14:33 [Bug python/13316] New: (cpychecker) Suspected memory leak in gdb/python/py-param.c: compute_enum_values dmalcolm at redhat dot com
2011-10-24 11:42 ` [Bug python/13316] " pmuldoon at redhat dot com
2013-11-01 18:01 ` tromey at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).