python api leak

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

 



was looking at the gimps python API, svn - gimp-pdb.c:311

GimpParam *
pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int 
nparams)
{
     PyObject *tuple, *item, *r, *g, *b, *x, *y, *w, *h;
     GimpParam *ret;
     int i, j, len;
     gint32 *i32a; gint16 *i16a; guint8 *i8a; gdouble *fa; gchar **sa;

     if (nparams == 0)
	tuple = PyTuple_New(0);
     else if (!PyTuple_Check(args) && nparams == 1)
	tuple = Py_BuildValue("(O)", args);
     else {
	Py_INCREF(args);
	tuple = args;
     }
     if (!PyTuple_Check(tuple)) {
	PyErr_SetString(PyExc_TypeError, "wrong type of parameter");
	return NULL;
     }

     if (PyTuple_Size(tuple) != nparams) {
	PyErr_SetString(PyExc_TypeError, "wrong number of parameters");
	return NULL;
     }
--- snip

Notice that tuple is always created, but error values dont free, I think 
both "return NULL;"'s need a Py_DECREF(tuple); before them.

-- 
Campbell J Barton (ideasman42)
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux