Commit 7b2b08ec authored by Felix Paul Kühne's avatar Felix Paul Kühne

vout ios: fix autorelease pool leak on error (closes #15402)

parent 98ec14de
...@@ -219,7 +219,6 @@ static int Open(vlc_object_t *this) ...@@ -219,7 +219,6 @@ static int Open(vlc_object_t *this)
return VLC_EGENERIC; return VLC_EGENERIC;
vout_display_sys_t *sys = calloc (1, sizeof(*sys)); vout_display_sys_t *sys = calloc (1, sizeof(*sys));
NSAutoreleasePool *autoreleasePool = nil;
if (!sys) if (!sys)
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -228,8 +227,7 @@ static int Open(vlc_object_t *this) ...@@ -228,8 +227,7 @@ static int Open(vlc_object_t *this)
sys->picturePool = NULL; sys->picturePool = NULL;
sys->gl.sys = NULL; sys->gl.sys = NULL;
autoreleasePool = [[NSAutoreleasePool alloc] init]; @autoreleasepool {
/* get the object we will draw into */ /* get the object we will draw into */
UIView* viewContainer = var_CreateGetAddress (vd, "drawable-nsobject"); UIView* viewContainer = var_CreateGetAddress (vd, "drawable-nsobject");
if (unlikely(viewContainer == nil)) if (unlikely(viewContainer == nil))
...@@ -333,14 +331,12 @@ static int Open(vlc_object_t *this) ...@@ -333,14 +331,12 @@ static int Open(vlc_object_t *this)
[sys->glESView performSelectorOnMainThread:@selector(reshape) [sys->glESView performSelectorOnMainThread:@selector(reshape)
withObject:nil withObject:nil
waitUntilDone:YES]; waitUntilDone:YES];
[autoreleasePool release];
return VLC_SUCCESS; return VLC_SUCCESS;
bailout: bailout:
[autoreleasePool release];
Close(this); Close(this);
return VLC_EGENERIC; return VLC_EGENERIC;
}
} }
void Close (vlc_object_t *this) void Close (vlc_object_t *this)
...@@ -348,6 +344,7 @@ void Close (vlc_object_t *this) ...@@ -348,6 +344,7 @@ void Close (vlc_object_t *this)
vout_display_t *vd = (vout_display_t *)this; vout_display_t *vd = (vout_display_t *)this;
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
@autoreleasepool {
if (sys->tapRecognizer) { if (sys->tapRecognizer) {
[sys->tapRecognizer.view removeGestureRecognizer:sys->tapRecognizer]; [sys->tapRecognizer.view removeGestureRecognizer:sys->tapRecognizer];
[sys->tapRecognizer release]; [sys->tapRecognizer release];
...@@ -377,6 +374,7 @@ void Close (vlc_object_t *this) ...@@ -377,6 +374,7 @@ void Close (vlc_object_t *this)
} }
free(sys); free(sys);
}
} }
/***************************************************************************** /*****************************************************************************
...@@ -400,12 +398,12 @@ static int Control(vout_display_t *vd, int query, va_list ap) ...@@ -400,12 +398,12 @@ static int Control(vout_display_t *vd, int query, va_list ap)
if (!vd->sys) if (!vd->sys)
return VLC_EGENERIC; return VLC_EGENERIC;
NSAutoreleasePool * autoreleasePool = [[NSAutoreleasePool alloc] init]; @autoreleasepool {
const vout_display_cfg_t *cfg; const vout_display_cfg_t *cfg;
const video_format_t *source; const video_format_t *source;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) { if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT ||
query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) {
source = (const video_format_t *)va_arg(ap, const video_format_t *); source = (const video_format_t *)va_arg(ap, const video_format_t *);
cfg = vd->cfg; cfg = vd->cfg;
} else { } else {
...@@ -436,8 +434,7 @@ static int Control(vout_display_t *vd, int query, va_list ap) ...@@ -436,8 +434,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
// x / y are top left corner, but we need the lower left one // x / y are top left corner, but we need the lower left one
if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE) if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
glViewport(place.x, cfg_tmp.display.height - (place.y + place.height), place.width, place.height); glViewport(place.x, cfg_tmp.display.height - (place.y + place.height), place.width, place.height);
}
[autoreleasePool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
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