[vlc-commits] libvlc: call exit() if command line help was requested

Rémi Denis-Courmont git at videolan.org
Sun Dec 2 09:22:24 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec  2 10:17:51 2012 +0200| [91bef24e89b317d84cae789bd6f075681fc3aa6e] | committer: Rémi Denis-Courmont

libvlc: call exit() if command line help was requested

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().

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

 src/libvlc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index fbb61e4..92892cb 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -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 )



More information about the vlc-commits mailing list