Commit 571c3e12 authored by Rafaël Carré's avatar Rafaël Carré

python bindings : fix pyoptions_to_args and a memleak in the same time

parent 1bab8298
...@@ -28,9 +28,6 @@ pyoptions_to_args(PyObject *py_options, char*** pppsz_args) ...@@ -28,9 +28,6 @@ pyoptions_to_args(PyObject *py_options, char*** pppsz_args)
{ {
Py_ssize_t i_size; Py_ssize_t i_size;
Py_ssize_t i_index; Py_ssize_t i_index;
char** ppsz_args = *pppsz_args;
ppsz_args = NULL;
Py_INCREF( py_options ); Py_INCREF( py_options );
if( ! PySequence_Check( py_options ) ) if( ! PySequence_Check( py_options ) )
...@@ -39,7 +36,9 @@ pyoptions_to_args(PyObject *py_options, char*** pppsz_args) ...@@ -39,7 +36,9 @@ pyoptions_to_args(PyObject *py_options, char*** pppsz_args)
return -1; return -1;
} }
i_size = PySequence_Size( py_options ); 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 ) if( ! ppsz_args )
{ {
PyErr_SetString( PyExc_MemoryError, "Out of memory" ); PyErr_SetString( PyExc_MemoryError, "Out of memory" );
......
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