]> git.sesse.net Git - vlc/commitdiff
python bindings, vlc_instance.c: fix memleak + use PyObject_DEL (patch
authorOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Tue, 29 May 2007 09:45:21 +0000 (09:45 +0000)
committerOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Tue, 29 May 2007 09:45:21 +0000 (09:45 +0000)
by Jan David Mol)

bindings/python/vlc_instance.c

index 7bdd7313bc5ddce42242890bb89cb6dde2bb683f..fb67db02bdc116181f6f82cca3f85aed5a67f903 100644 (file)
@@ -82,9 +82,6 @@ vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
     char** ppsz_args = NULL;
     int i_size = 0;
 
-    self = PyObject_New( vlcInstance, &vlcInstance_Type );
-
-
     if( PyArg_ParseTuple( args, "O", &py_list ) )
     {
         i_size = pyoptions_to_args( py_list, &ppsz_args );
@@ -98,6 +95,8 @@ vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
         PyErr_Clear( );
     }
 
+    self = PyObject_New( vlcInstance, &vlcInstance_Type );
+
     Py_BEGIN_ALLOW_THREADS
     LIBVLC_TRY
     LIBVLC_INSTANCE->p_instance = libvlc_new( i_size, ppsz_args, &ex );
@@ -114,7 +113,7 @@ vlcInstance_dealloc( PyObject *self )
 {
     libvlc_exception_t ex;
     libvlc_destroy( LIBVLC_INSTANCE->p_instance, &ex );
-    PyMem_DEL( self );
+    PyObject_DEL( self );
 }
 
 static PyObject *