[vlc-commits] item: fix undefined zero-size array
Rémi Denis-Courmont
git at videolan.org
Mon Apr 14 22:40:34 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Apr 14 23:33:37 2014 +0300| [c2e56e6b8fe1c4b4ac7173faafd02edb37502a5c] | committer: Rémi Denis-Courmont
item: fix undefined zero-size array
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c2e56e6b8fe1c4b4ac7173faafd02edb37502a5c
---
src/input/item.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/input/item.c b/src/input/item.c
index e225657..b27250b 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -772,22 +772,27 @@ void input_item_SetEpgOffline( input_item_t *p_item )
#ifdef EPG_DEBUG
vlc_mutex_lock( &p_item->lock );
const int i_epg_info = p_item->i_epg;
- char *ppsz_epg_info[i_epg_info];
- for( int i = 0; i < p_item->i_epg; i++ )
+ if( i_epg_info > 0 )
{
- const vlc_epg_t *p_epg = p_item->pp_epg[i];
- if( asprintf( &ppsz_epg_info[i], "EPG %s", p_epg->psz_name ? p_epg->psz_name : "unknown" ) < 0 )
- ppsz_epg_info[i] = NULL;
- }
- vlc_mutex_unlock( &p_item->lock );
+ char *ppsz_epg_info[i_epg_info];
+ for( int i = 0; i < p_item->i_epg; i++ )
+ {
+ const vlc_epg_t *p_epg = p_item->pp_epg[i];
+ if( asprintf( &ppsz_epg_info[i], "EPG %s", p_epg->psz_name ? p_epg->psz_name : "unknown" ) < 0 )
+ ppsz_epg_info[i] = NULL;
+ }
+ vlc_mutex_unlock( &p_item->lock );
- for( int i = 0; i < i_epg_info; i++ )
- {
- if( !ppsz_epg_info[i] )
- continue;
- input_item_DelInfo( p_item, ppsz_epg_info[i], NULL );
- free( ppsz_epg_info[i] );
+ for( int i = 0; i < i_epg_info; i++ )
+ {
+ if( !ppsz_epg_info[i] )
+ continue;
+ input_item_DelInfo( p_item, ppsz_epg_info[i], NULL );
+ free( ppsz_epg_info[i] );
+ }
}
+ else
+ vlc_mutex_unlock( &p_item->lock );
#endif
vlc_event_t event = { .type = vlc_InputItemInfoChanged, };
More information about the vlc-commits
mailing list