Commit 4e0ec1d2 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

macosx/framework: Fix a bunch of leaks in -[VLCMediaPlayer videoSubTitles].

parent e50b4711
...@@ -316,18 +316,14 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -316,18 +316,14 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (NSArray *)videoSubTitles - (NSArray *)videoSubTitles
{ {
libvlc_exception_t ex; libvlc_track_description_t *currentTrack = libvlc_video_get_spu_description( instance, &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 );
NSMutableArray *tempArray = [NSMutableArray array]; NSMutableArray *tempArray = [NSMutableArray array];
NSInteger i; while (currentTrack) {
for (i = 0; i < count; i++) [tempArray addObject:[NSString stringWithUTF8String:currentTrack->psz_name]];
{ free(currentTrack->psz_name);
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]]; libvlc_track_description_t *tofree = currentTrack;
tracks = tracks->p_next; currentTrack = currentTrack->p_next;
free(tofree);
} }
return [NSArray arrayWithArray: tempArray]; return [NSArray arrayWithArray: tempArray];
} }
......
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