]> git.sesse.net Git - vlc/commitdiff
libvlc: call exit() if command line help was requested
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 2 Dec 2012 08:17:51 +0000 (10:17 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 2 Dec 2012 08:17:51 +0000 (10:17 +0200)
A library should not call exit(), but I do not see any easy way around
it: if libvlc_new() returns NULL on error so real errors cannot be
distinguished from --help stuff. Also --daemon already calls exit()
(through daemon()).

This introduces an O(1) memory leak when calling --help. It could be
fixed by merging libvlc_InternalCreate() and libvlc_InternalInit().

src/libvlc.c

index fbb61e4bc92bd4671b0aec6f7182cc909e0a138d..92892cb6ab997010cea920a5af6ed239fb5c632f 100644 (file)
@@ -224,7 +224,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     if (config_PrintHelp (VLC_OBJECT(p_libvlc)))
     {
         module_EndBank (true);
-        return VLC_EEXITSUCCESS;
+        exit(0);
     }
 
     if( module_count <= 1 )