]> git.sesse.net Git - vlc/commitdiff
python bindings : fix pyoptions_to_args and a memleak in the same time
authorRafaël Carré <funman@videolan.org>
Tue, 25 Mar 2008 09:53:13 +0000 (10:53 +0100)
committerRafaël Carré <funman@videolan.org>
Tue, 25 Mar 2008 09:53:13 +0000 (10:53 +0100)
bindings/python/vlc_instance.c

index 332eb2655970ff76d8c72e3f38ef39ace21301b9..a9228dd2a63c338d7fc58d7e61bafc903378eaa3 100644 (file)
@@ -28,9 +28,6 @@ pyoptions_to_args(PyObject *py_options, char*** pppsz_args)
 {
     Py_ssize_t i_size;
     Py_ssize_t  i_index;
-    char** ppsz_args = *pppsz_args;
-    ppsz_args = NULL;
 
     Py_INCREF( py_options );
     if( ! PySequence_Check( py_options ) )
@@ -39,7 +36,9 @@ pyoptions_to_args(PyObject *py_options, char*** pppsz_args)
         return -1;
     }
     i_size = PySequence_Size( py_options );
-    ppsz_args = malloc( ( i_size + 1 ) * sizeof( char * ) );
+
+    char **ppsz_args = *pppsz_args = malloc( ( i_size + 1 ) * sizeof( char * ) );
+
     if( ! ppsz_args )
     {
         PyErr_SetString( PyExc_MemoryError, "Out of memory" );