[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: PATCH: pyparted: Fix various python object leaks in convert.c
- From: Chris Lumens <clumens redhat com>
- To: anaconda-devel-list redhat com
- Subject: Re: PATCH: pyparted: Fix various python object leaks in convert.c
- Date: Fri, 20 Feb 2009 11:02:30 -0500
I agree with the general sentiment, but jumping into the middle of an if
block like this:
> --- a/src/convert.c
> +++ b/src/convert.c
> @@ -97,13 +97,17 @@ _ped_Alignment
> *PedAlignment2_ped_Alignment(PedAlignment *alignment) {
>
> args = Py_BuildValue("LL", alignment->offset, alignment->grain_size);
> if (args == NULL) {
> - return NULL;
> + goto error;
> }
>
> if (_ped_Alignment_Type_obj.tp_init((PyObject *) ret, args, NULL)) {
> - return NULL;
> +error:
> + Py_DECREF(ret);
> + ret = NULL;
> }
>
> + Py_XDECREF(args);
> +
> return ret;
> }
fills me with a sense of dread. Can you please accomplish the same
thing in a slightly less bizarre way? Note that I have nothing against
using goto for this at all. It's just where you're goingto that bugs
me.
- Chris
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]