Avoid a malloc(0) (We don't call free on it, valgrind is not happy)
authorLaurent Aimar <fenrir@videolan.org>
Wed, 21 Feb 2007 22:56:43 +0000 (22:56 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 21 Feb 2007 22:56:43 +0000 (22:56 +0000)
modules/demux/ts.c

index d307433..391fee1 100644 (file)
@@ -3307,9 +3307,10 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
                         break;
                     }
                     pid->es->fmt.i_extra_languages = p_decoded->i_code_count-1;
-                    pid->es->fmt.p_extra_languages =
-                        malloc( sizeof(*pid->es->fmt.p_extra_languages) *
-                                pid->es->fmt.i_extra_languages );
+                    if( pid->es->fmt.i_extra_languages > 0 )
+                        pid->es->fmt.p_extra_languages =
+                            malloc( sizeof(*pid->es->fmt.p_extra_languages) *
+                                    pid->es->fmt.i_extra_languages );
                     for( i = 0; i < pid->es->fmt.i_extra_languages; i++ ) {
                         msg_Dbg( p_demux, "bang" );
                         pid->es->fmt.p_extra_languages[i].psz_language =