[vlc-commits] input: fix forward NULL
Rémi Denis-Courmont
git at videolan.org
Sun Sep 14 16:58:51 CEST 2014
vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 14 17:57:49 2014 +0300| [246d92bc05bb4e6e63d207d95242f1461b5549c0] | committer: Rémi Denis-Courmont
input: fix forward NULL
(cherry picked from commit dd6170364ffa7a6cc2248f2ef8b1f98e25f95589)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=246d92bc05bb4e6e63d207d95242f1461b5549c0
---
src/input/control.c | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/src/input/control.c b/src/input/control.c
index a4b2842..8a03b1c 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -530,28 +530,34 @@ static void UpdateBookmarksOption( input_thread_t *p_input )
}
char *psz_value = malloc( i_len + p_input->p->i_bookmark + 1 );
- char *psz_next = psz_value;
- psz_next += sprintf( psz_next, "bookmarks=" );
- for( int i = 0; i < p_input->p->i_bookmark && psz_value != NULL; i++ )
+ if( psz_value != NULL )
{
- const seekpoint_t *p_bookmark = p_input->p->pp_bookmark[i];
+ strcpy( psz_value, "bookmarks=" );
- psz_next += sprintf( psz_next, psz_format,
- p_bookmark->psz_name,
- p_bookmark->i_byte_offset,
- p_bookmark->i_time_offset/1000000 );
+ char *psz_next = psz_value + strlen( "bookmarks" );
- if( i < p_input->p->i_bookmark - 1)
- *psz_next++ = ',';
- }
- vlc_mutex_unlock( &p_input->p->p_item->lock );
+ for( int i = 0; i < p_input->p->i_bookmark && psz_value != NULL; i++ )
+ {
+ const seekpoint_t *p_bookmark = p_input->p->pp_bookmark[i];
- if( psz_value )
- input_item_AddOption( p_input->p->p_item, psz_value, VLC_INPUT_OPTION_UNIQUE );
+ psz_next += sprintf( psz_next, psz_format,
+ p_bookmark->psz_name,
+ p_bookmark->i_byte_offset,
+ p_bookmark->i_time_offset/1000000 );
- free( psz_value );
+ if( i < p_input->p->i_bookmark - 1)
+ *psz_next++ = ',';
+ }
+ }
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
+ if( psz_value != NULL )
+ {
+ input_item_AddOption( p_input->p->p_item, psz_value,
+ VLC_INPUT_OPTION_UNIQUE );
+ free( psz_value );
+ }
input_SendEventBookmark( p_input );
}
More information about the vlc-commits
mailing list