Re: PATCH: pyparted: Fix various python object leaks in convert.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux