Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: gdb-patches@sourceware.org
Subject: [python] [patch] PR python/13316
Date: Mon, 24 Oct 2011 12:54:00 -0000	[thread overview]
Message-ID: <m339eimuv3.fsf@redhat.com> (raw)


This patch (found by David Malcolm's GCC plug-in Python reference
check), fixes a case where we do not decrement a value in two branches
of py-param.c:compute_enum_values.

OK?

Cheers,

Phil

--

2011-10-24  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/13316

	* python/py-param.c (compute_enum_values): Decrement decrement
	PyObjects on function exit.
--


Index: python/py-param.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-param.c,v
retrieving revision 1.14
diff -u -r1.14 py-param.c
--- python/py-param.c	24 Oct 2011 11:39:50 -0000	1.14
+++ python/py-param.c	24 Oct 2011 12:28:52 -0000
@@ -605,9 +605,12 @@
 	  do_cleanups (back_to);
 	  PyErr_SetString (PyExc_RuntimeError, 
 			   _("The enumeration item not a string."));
+	  Py_DECREF (item);
 	  return 0;
 	}
       self->enumeration[i] = python_string_to_host_string (item);
+      Py_DECREF (item);
+
       if (self->enumeration[i] == NULL)
 	{
 	  do_cleanups (back_to);


             reply	other threads:[~2011-10-24 12:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24 12:54 Phil Muldoon [this message]
2011-10-24 13:48 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m339eimuv3.fsf@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox