[vlc-devel] commit: macosx/framework: Fix a bunch of leaks in -[ VLCMediaPlayer videoSubTitles]. (Pierre d'Herbemont )
git version control
git at videolan.org
Sun Jan 24 15:48:39 CET 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Sun Jan 24 11:46:00 2010 +0100| [4e0ec1d2c8b66b6c2bf10cffc315f504f3238679] | committer: Pierre d'Herbemont
macosx/framework: Fix a bunch of leaks in -[VLCMediaPlayer videoSubTitles].
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4e0ec1d2c8b66b6c2bf10cffc315f504f3238679
---
projects/macosx/framework/Sources/VLCMediaPlayer.m | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/projects/macosx/framework/Sources/VLCMediaPlayer.m b/projects/macosx/framework/Sources/VLCMediaPlayer.m
index 51b535e..0c48bb5 100644
--- a/projects/macosx/framework/Sources/VLCMediaPlayer.m
+++ b/projects/macosx/framework/Sources/VLCMediaPlayer.m
@@ -316,18 +316,14 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (NSArray *)videoSubTitles
{
- libvlc_exception_t ex;
- libvlc_exception_init( &ex );
- NSInteger count = libvlc_video_get_spu_count( instance, &ex );
- catch_exception( &ex );
-
- libvlc_track_description_t *tracks = libvlc_video_get_spu_description( instance, &ex );
+ libvlc_track_description_t *currentTrack = libvlc_video_get_spu_description( instance, &ex );
NSMutableArray *tempArray = [NSMutableArray array];
- NSInteger i;
- for (i = 0; i < count; i++)
- {
- [tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
- tracks = tracks->p_next;
+ while (currentTrack) {
+ [tempArray addObject:[NSString stringWithUTF8String:currentTrack->psz_name]];
+ free(currentTrack->psz_name);
+ libvlc_track_description_t *tofree = currentTrack;
+ currentTrack = currentTrack->p_next;
+ free(tofree);
}
return [NSArray arrayWithArray: tempArray];
}
More information about the vlc-devel
mailing list