[vlc-devel] commit: psz_object_name should not be const! ( else module name aliasing cannot work) (Antoine Cellerier )

Rafaël Carré funman at videolan.org
Thu Apr 24 18:41:02 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Le Wed, 23 Apr 2008 00:44:44 +0200 (CEST),
git at videolan.org (git version control) a écrit :

> vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Tue
> Apr 22 23:00:55 2008 +0200| [f864df7f99aac0babaa434b88104cf93fc71b840]
> 
> psz_object_name should not be const! (else module name aliasing
> cannot work)

> @@ -254,16 +254,18 @@ int libvlc_InternalInit( libvlc_int_t
> *p_libvlc, int i_argc, /* Get the executable name (similar to the
> basename command) */ if( i_argc > 0 )
>      {
> -        const char *exe = p_libvlc->psz_object_name = ppsz_argv[0];
> +        const char *exe = strdup( ppsz_argv[0] );

You are leaking here.

> +        const char *tmp = exe;
>          while( *exe )
>          {
>              if( *exe++ == '/' )
> -                p_libvlc->psz_object_name = exe;
> +                tmp = exe;
>          }
> +        p_libvlc->psz_object_name = strdup( tmp );

Because you strdup() here.

- -- 
Rafaël Carré
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIELggYWCeGMCv8Q8RAsSMAJ9nzUCDs7ycKLlobgKBXv0HXuUIhACg3OCR
eDAx2CDguvOtSrKGCVxeX6Q=
=vOHz
-----END PGP SIGNATURE-----


More information about the vlc-devel mailing list