[vlc-commits] libvlc: fix libvlc_media_slaves_release with a count of 0
Thomas Guillem
git at videolan.org
Tue May 31 16:23:36 CEST 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue May 31 15:13:42 2016 +0200| [26cde75f29a8cc7cf916adeaf8350382f0e7f122] | committer: Thomas Guillem
libvlc: fix libvlc_media_slaves_release with a count of 0
Since pp_slaves is not initialised when libvlc_media_slaves_get() returns 0.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=26cde75f29a8cc7cf916adeaf8350382f0e7f122
---
lib/media.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/media.c b/lib/media.c
index 1f7db2c..1f7acae 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -1220,8 +1220,11 @@ unsigned int libvlc_media_slaves_get( libvlc_media_t *p_md,
void libvlc_media_slaves_release( libvlc_media_slave_t **pp_slaves,
unsigned int i_count )
{
- assert( pp_slaves );
- for( unsigned int i = 0; i < i_count; ++i )
- free(pp_slaves[i]);
- free(pp_slaves);
+ if( i_count > 0 )
+ {
+ assert( pp_slaves );
+ for( unsigned int i = 0; i < i_count; ++i )
+ free( pp_slaves[i] );
+ free( pp_slaves );
+ }
}
More information about the vlc-commits
mailing list