Commit 60b9fae6 authored by Filip Roséen's avatar Filip Roséen Committed by Hugo Beauzée-Luyssen

gui/qt: info_panels: fix leak + potential null-dereference

vlc_meta_CopyExtraNames returns a pointer to a dynamically allocated
resource, this should of course be cleaned up after it is used; we
should also not assume that the function is always successful, but
instead check to see that we really have data to use in order to
prevent *undefined-behavior*.

CID: #1401545
Signed-off-by: Hugo Beauzée-Luyssen's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent b037dd3e
......@@ -440,11 +440,15 @@ void ExtraMetaPanel::update( input_item_t *p_item )
add_row( VLC_META_DISCNUMBER, psz_disc );
char ** ppsz_keys = vlc_meta_CopyExtraNames( p_meta );
for( int i = 0; ppsz_keys[i]; ++i )
if( ppsz_keys )
{
add_row( ppsz_keys[i], vlc_meta_GetExtra( p_meta, ppsz_keys[i] ) );
free( ppsz_keys[i] );
for( int i = 0; ppsz_keys[i]; ++i )
{
add_row( ppsz_keys[i], vlc_meta_GetExtra( p_meta, ppsz_keys[i] ) );
free( ppsz_keys[i] );
}
free( ppsz_keys );
}
extraMeta->verticalHeader()->resizeSections( QHeaderView::ResizeToContents );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment