Commit 77db2e04 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vdpau: fix VRAM leak on error

(cherry picked from commit 5bf47e957dfb794dfb96acb9c928fc8d87205d35)
parent 5cca79e4
......@@ -60,7 +60,7 @@ struct vlc_va_sys_t
uint16_t height;
};
static int Lock(vlc_va_t *va, void **opaque, uint8_t **data)
static vlc_vdp_video_field_t *CreateSurface(vlc_va_t *va)
{
vlc_va_sys_t *sys = va->sys;
VdpVideoSurface surface;
......@@ -72,15 +72,23 @@ static int Lock(vlc_va_t *va, void **opaque, uint8_t **data)
{
msg_Err(va, "%s creation failure: %s", "video surface",
vdp_get_error_string(sys->vdp, err));
return VLC_EGENERIC;
return NULL;
}
vlc_vdp_video_field_t *field = vlc_vdp_video_create(sys->vdp, surface);
if (unlikely(field == NULL))
vdp_video_surface_destroy(sys->vdp, surface);
return field;
}
static int Lock(vlc_va_t *va, void **opaque, uint8_t **data)
{
vlc_vdp_video_field_t *field = CreateSurface(va);
if (unlikely(field == NULL))
return VLC_ENOMEM;
*data = (void *)(uintptr_t)surface;
*opaque = field;
*data = (void *)(uintptr_t)field->frame->surface;
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