зеркало из https://github.com/mozilla/pjs.git
Fix a memory leak when Python calls nsIClassInfo::GetInterfaces()
Not part of the default build.
This commit is contained in:
Родитель
cfbafe6467
Коммит
33f261a4ce
|
@ -70,6 +70,7 @@ static PyObject *PyGetInterfaces(PyObject *self, PyObject *args)
|
||||||
nsIID** iidArray = nsnull;
|
nsIID** iidArray = nsnull;
|
||||||
PRUint32 iidCount = 0;
|
PRUint32 iidCount = 0;
|
||||||
nsresult r;
|
nsresult r;
|
||||||
|
PRUint32 i;
|
||||||
Py_BEGIN_ALLOW_THREADS;
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
r = pI->GetInterfaces(&iidCount, &iidArray);
|
r = pI->GetInterfaces(&iidCount, &iidArray);
|
||||||
Py_END_ALLOW_THREADS;
|
Py_END_ALLOW_THREADS;
|
||||||
|
@ -78,9 +79,11 @@ static PyObject *PyGetInterfaces(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
PyObject *ret = PyTuple_New(iidCount);
|
PyObject *ret = PyTuple_New(iidCount);
|
||||||
if (ret==NULL)
|
if (ret==NULL)
|
||||||
return NULL;
|
goto done;
|
||||||
for (PRUint32 i=0;i<iidCount;i++)
|
for (i=0;i<iidCount;i++)
|
||||||
PyTuple_SET_ITEM( ret, i, Py_nsIID::PyObjectFromIID(*(iidArray[i])) );
|
PyTuple_SET_ITEM( ret, i, Py_nsIID::PyObjectFromIID(*(iidArray[i])) );
|
||||||
|
done:
|
||||||
|
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(iidCount, iidArray);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче