From 571c3e12bbc8ee80a8cbeda3df13c8fd7c303fa7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Tue, 25 Mar 2008 10:53:13 +0100 Subject: [PATCH] python bindings : fix pyoptions_to_args and a memleak in the same time --- bindings/python/vlc_instance.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bindings/python/vlc_instance.c b/bindings/python/vlc_instance.c index 332eb26559..a9228dd2a6 100644 --- a/bindings/python/vlc_instance.c +++ b/bindings/python/vlc_instance.c @@ -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" ); -- 2.39.5