From: Michael Snyder <msnyder@vmware.com>
To: Tom Tromey <tromey@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
Phil Muldoon <pmuldoon@redhat.com>
Subject: Re: [RFA] py-inferior.c, check return value of PyList_Append
Date: Wed, 02 Mar 2011 20:40:00 -0000 [thread overview]
Message-ID: <4D6EAB36.2040804@vmware.com> (raw)
In-Reply-To: <m3r5ap1d63.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 602 bytes --]
Tom Tromey wrote:
>>>>>> "Michael" == Michael Snyder <msnyder@vmware.com> writes:
>
> Michael> Just making this up as I go, here, need a review.
> Michael> 2011-03-02 Michael Snyder <msnyder@vmware.com>
> Michael> * py-inferior.c (inferior_to_inferior_object): Check return
>
> Should be build_inferior_list, not inferior_to_inferior_object.
>
> This code is kind of bogus. I agree with your change, but then the
> caller needs a change as well. It should do something like:
>
> if (iterate_over_inferiors (...))
> {
> Py_DECREF (list);
> return NULL;
> }
>
> Tom
Like this?
[-- Attachment #2: py-inferior2.txt --]
[-- Type: text/plain, Size: 1070 bytes --]
2011-03-02 Michael Snyder <msnyder@vmware.com>
* python/py-inferior.c (build_inferior_list): Error out if
PyList_Append fails.
(gdbpy_inferiors): Error out if build_inferior_list fails.
Index: python/py-inferior.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-inferior.c,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 py-inferior.c
--- python/py-inferior.c 4 Feb 2011 21:54:16 -0000 1.5
+++ python/py-inferior.c 2 Mar 2011 20:38:01 -0000
@@ -326,7 +326,9 @@ build_inferior_list (struct inferior *in
PyObject *list = arg;
PyObject *inferior = inferior_to_inferior_object (inf);
- PyList_Append (list, inferior);
+ if (PyList_Append (list, inferior))
+ return 1;
+
return 0;
}
@@ -343,7 +345,11 @@ gdbpy_inferiors (PyObject *unused, PyObj
if (!list)
return NULL;
- iterate_over_inferiors (build_inferior_list, list);
+ if (iterate_over_inferiors (build_inferior_list, list))
+ {
+ Py_DECREF (list);
+ return NULL;
+ }
return PyList_AsTuple (list);
}
next prev parent reply other threads:[~2011-03-02 20:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-02 18:44 Michael Snyder
2011-03-02 20:27 ` Tom Tromey
2011-03-02 20:40 ` Michael Snyder [this message]
2011-03-02 20:56 ` Tom Tromey
2011-03-02 21:21 ` Michael Snyder
-- strict thread matches above, loose matches on Subject: below --
2011-03-02 18:43 Michael Snyder
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=4D6EAB36.2040804@vmware.com \
--to=msnyder@vmware.com \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@redhat.com \
--cc=tromey@redhat.com \
/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