Bug 13310 - (cpychecker) Suspected memory leak in gdb/python/py-param.c: call_doc_function()
Summary: (cpychecker) Suspected memory leak in gdb/python/py-param.c: call_doc_function()
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.4
Assignee: Phil Muldoon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-17 20:17 UTC by Dave Malcolm
Modified: 2011-10-24 11:41 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
HTML report showing the execution paths that leak memory (3.00 KB, text/html)
2011-10-17 20:17 UTC, Dave Malcolm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Malcolm 2011-10-17 20:17:01 UTC
Created attachment 6012 [details]
HTML report showing the execution paths that leak memory

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

  result->ob_refcnt is 1 too high:

It looks to me like the returned "result" object from PyObject_CallMethodObjArgs() is leaking a reference in each of these paths through the function.

Caveat: this static analyzer is relatively immature, so it could be getting it wrong.
Comment 1 Sourceware Commits 2011-10-24 11:39:54 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	pmuldoon@sourceware.org	2011-10-24 11:39:50

Modified files:
	gdb            : ChangeLog 
	gdb/python     : py-param.c 

Log message:
	2011-10-24  Phil Muldoon  <pmuldoon@redhat.com>
	
	PR python/13310
	
	* python/py-param.c (call_doc_function): Correctly deference on
	function exit.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13450&r2=1.13451
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/python/py-param.c.diff?cvsroot=src&r1=1.13&r2=1.14
Comment 2 Phil Muldoon 2011-10-24 11:41:22 UTC
Fixed and committed as documented in Comment #1.