[vlc-devel] commit: python bindings : fix pyoptions_to_args and a memleak in the same time ( Rafaël Carré )

git version control git at videolan.org
Tue Mar 25 10:54:02 CET 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Mar 25 10:53:13 2008 +0100| [571c3e12bbc8ee80a8cbeda3df13c8fd7c303fa7]

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=571c3e12bbc8ee80a8cbeda3df13c8fd7c303fa7
---

 bindings/python/vlc_instance.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/bindings/python/vlc_instance.c b/bindings/python/vlc_instance.c
index 332eb26..a9228dd 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" );




More information about the vlc-devel mailing list