Commit 12e055f6 authored by Olivier Aubert's avatar Olivier Aubert

python bindings, vlc_instance.c: fix memleak + use PyObject_DEL (patch

by Jan David Mol)
parent 11884b88
...@@ -82,9 +82,6 @@ vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds ) ...@@ -82,9 +82,6 @@ vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
char** ppsz_args = NULL; char** ppsz_args = NULL;
int i_size = 0; int i_size = 0;
self = PyObject_New( vlcInstance, &vlcInstance_Type );
if( PyArg_ParseTuple( args, "O", &py_list ) ) if( PyArg_ParseTuple( args, "O", &py_list ) )
{ {
i_size = pyoptions_to_args( py_list, &ppsz_args ); i_size = pyoptions_to_args( py_list, &ppsz_args );
...@@ -98,6 +95,8 @@ vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds ) ...@@ -98,6 +95,8 @@ vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
PyErr_Clear( ); PyErr_Clear( );
} }
self = PyObject_New( vlcInstance, &vlcInstance_Type );
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
LIBVLC_TRY LIBVLC_TRY
LIBVLC_INSTANCE->p_instance = libvlc_new( i_size, ppsz_args, &ex ); LIBVLC_INSTANCE->p_instance = libvlc_new( i_size, ppsz_args, &ex );
...@@ -114,7 +113,7 @@ vlcInstance_dealloc( PyObject *self ) ...@@ -114,7 +113,7 @@ vlcInstance_dealloc( PyObject *self )
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_destroy( LIBVLC_INSTANCE->p_instance, &ex ); libvlc_destroy( LIBVLC_INSTANCE->p_instance, &ex );
PyMem_DEL( self ); PyObject_DEL( self );
} }
static PyObject * static PyObject *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment