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

omx: fix memory leak on error

parent a390896f
...@@ -289,16 +289,19 @@ static int Open(vlc_object_t *p_this) ...@@ -289,16 +289,19 @@ static int Open(vlc_object_t *p_this)
if (!pictures) if (!pictures)
goto error; goto error;
for (unsigned int i = 0; i < p_sys->port.i_buffers; i++) { for (unsigned int i = 0; i < p_sys->port.i_buffers; i++) {
picture_resource_t resource = { 0 }; picture_sys_t *picsys = malloc(sizeof(*picsys));
picture_resource_t *rsc = &resource; if (unlikely(picsys == NULL))
rsc->p_sys = malloc(sizeof(*rsc->p_sys));
if (!rsc->p_sys)
goto error; goto error;
rsc->p_sys->sys = p_sys; picsys->sys = p_sys;
picture_t *picture = picture_NewFromResource(&fmt, rsc); picture_resource_t resource = { .p_sys = picsys };
if (!picture)
picture_t *picture = picture_NewFromResource(&fmt, &resource);
if (unlikely(picture == NULL))
{
free(picsys);
goto error; goto error;
}
pictures[i] = picture; pictures[i] = picture;
} }
......
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