public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: fix latent leak in cmdpy_function
@ 2010-10-19 20:11 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2010-10-19 20:11 UTC (permalink / raw)
  To: gdb-patches

I'm checking this in.

PyErr_Fetch gives the caller a reference to each returned object.
This patch changes cmdpy_function to decref the objects in the branch
where PyErr_Restore is not called.

Built and regtested on x86-64 (compile farm).

Tom

2010-10-19  Tom Tromey  <tromey@redhat.com>

	* python/py-cmd.c (cmdpy_function): Unreference exception state.

Index: python/py-cmd.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-cmd.c,v
retrieving revision 1.8
diff -u -r1.8 py-cmd.c
--- python/py-cmd.c	13 Oct 2010 13:24:39 -0000	1.8
+++ python/py-cmd.c	19 Oct 2010 20:09:01 -0000
@@ -192,7 +192,12 @@
 	    error (_("Error occurred in Python command."));
 	}
       else
-	error ("%s", msg);
+	{
+	  Py_XDECREF (ptype);
+	  Py_XDECREF (pvalue);
+	  Py_XDECREF (ptraceback);
+	  error ("%s", msg);
+	}
     }
 
   Py_DECREF (result);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-19 20:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-19 20:11 FYI: fix latent leak in cmdpy_function Tom Tromey

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).