]> git.sesse.net Git - vlc/blobdiff - extras/analyser/zsh.cpp
zsh: fix some others memory leaks.
[vlc] / extras / analyser / zsh.cpp
index e5b10fa9f14c57aaca86e40de2f43e4733d494db..7eb2bf23c16b2b65754a29143aad1a51baf9dcd0 100644 (file)
@@ -60,8 +60,11 @@ int main( int i_argc, const char **ppsz_argv )
     libvlc_exception_t ex;
     libvlc_exception_init(&ex);
 
-    const char * const argv[] = { "vlc" };
-    libvlc_instance_t *p_libvlc_instance = libvlc_new(1, argv, &ex);
+    const char *argv[i_argc + 1];
+    argv[0] = "vlc";
+    for( int i = 0; i < i_argc; i++ )
+        argv[i+1] = ppsz_argv[i];
+    libvlc_instance_t *p_libvlc_instance = libvlc_new(i_argc+1, argv, &ex);
 
     if( !p_libvlc_instance || libvlc_exception_raised(&ex) )
     {
@@ -151,6 +154,7 @@ void ParseModules( mumap &mods, mcmap &mods2 )
         while( i_items++ < p_module->i_config_items && p_item++ );
 
     }
+    module_list_free( p_list );
 }
 
 void PrintModuleList( mumap &mods, mcmap &mods2 )
@@ -195,6 +199,7 @@ void PrintModuleList( mumap &mods, mcmap &mods2 )
 
     }
     printf( "\"\n\n" );
+    module_list_free( p_list );
     return;
 }
 
@@ -424,10 +429,12 @@ void PrintOption( char *psz_option, char i_short, char *psz_exclusive,
         strchr( psz_longtext, '(' ) ) psz_longtext = psz_text;
     if( i_short )
     {
-        if( !psz_exclusive ) psz_exclusive = strdup( "" );
-        else asprintf( &psz_exclusive, " %s", psz_exclusive );
-        printf( "  \"(-%c%s)--%s%s[%s]", i_short, psz_exclusive,
-                psz_option, psz_args?"=":"", psz_text );
+        if( !psz_exclusive )
+            printf( "  \"(-%c)--%s%s[%s]", i_short,
+                    psz_option, psz_args?"=":"", psz_text );
+        else
+            printf( "  \"(-%c%s)--%s%s[%s]", i_short, psz_exclusive,
+                    psz_option, psz_args?"=":"", psz_text );
         if( psz_args )
             printf( ":%s:%s\"\\\n", psz_longtext, psz_args );
         else
@@ -452,7 +459,6 @@ void PrintOption( char *psz_option, char i_short, char *psz_exclusive,
             printf( ":%s:%s\"\\\n", psz_longtext, psz_args );
         else
             printf( "\"\\\n" );
-
     }
 }