]> git.sesse.net Git - vlc/blobdiff - include/vlc_es.h
A bit of vlc/libvlc cleanup:
[vlc] / include / vlc_es.h
index b00142a97961e60bc635dd73a1339c53ec4d71b6..ba78dec76feedfdfbcabe0124a71b50663cf3bb3 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#if !defined( __LIBVLC__ )
+  #error You are not libvlc or one of its plugins. You cannot include this file
+#endif
+
 #ifndef _VLC_ES_H
 #define _VLC_ES_H 1
 
@@ -245,7 +249,9 @@ static inline void es_format_Copy( es_format_t *dst, es_format_t *src )
     }
 
     dst->i_extra_languages = src->i_extra_languages;
-    dst->p_extra_languages = (extra_languages_t*) malloc( dst->i_extra_languages * sizeof(*dst->p_extra_languages ) );
+    if( dst->i_extra_languages )
+        dst->p_extra_languages = (extra_languages_t*)
+            malloc(dst->i_extra_languages * sizeof(*dst->p_extra_languages ));
     for( i = 0; i < dst->i_extra_languages; i++ ) {
         if( src->p_extra_languages[i].psz_language )
             dst->p_extra_languages[i].psz_language = strdup(src->p_extra_languages[i].psz_language);