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

picture: factor freeing picture_t

Due to private members, manually allocating a picture has not been
possible for a while. So we can assume that all picture_t are allocated
with either picture_NewFromResource() or picture_NewFromFormat().
And we can then just factor the final free() call.
parent 668d0178
......@@ -499,7 +499,6 @@ static void DestroyPicture(picture_t *picture)
picture_sys_t *p_sys = picture->p_sys;
ReleasePictureSys( p_sys );
free(p_sys);
free(picture);
}
static void DeleteFilter( filter_t * p_filter )
......
......@@ -175,7 +175,6 @@ static void DestroyPicture(picture_t *picture)
picture_sys_t *p_sys = picture->p_sys;
ReleasePictureSys( p_sys );
free(p_sys);
free(picture);
}
static void DeleteFilter( filter_t * p_filter )
......
......@@ -564,7 +564,6 @@ pool_pic_destroy_cb(picture_t *pic)
free(instance);
}
free(pic->p_sys);
free(pic);
}
static void
......
......@@ -80,7 +80,6 @@ static void pictureSys_DestroyVDPAU(picture_sys_t *psys)
static void PictureDestroyVDPAU(picture_t *pic)
{
pictureSys_DestroyVDPAU(pic->p_sys);
free(pic);
}
static VdpStatus picture_NewVDPAU(vdp_t *vdp, VdpRGBAFormat rgb_fmt,
......
......@@ -1085,7 +1085,6 @@ static void pic_rsc_destroy(picture_t *pic)
{
for (unsigned i = 0; i < 3; i++)
free(pic->p[i].p_pixels);
free(pic);
}
static picture_t *pic_new_unaligned(const video_format_t *fmt)
......
......@@ -101,7 +101,6 @@ static inline void AndroidOpaquePicture_DetachVout(picture_t *p_pic)
}
else
vlc_mutex_unlock(&p_picsys->hw.lock);
free(p_pic);
}
static inline void
......
......@@ -605,7 +605,6 @@ static void CustomDestroyPicture(picture_t *p_picture)
vlc_close(sys->drm_fd);
sys->drm_fd = 0;
free(p_picture->p_sys);
free(p_picture);
}
......
......@@ -114,7 +114,6 @@ pbo_picture_destroy(picture_t *pic)
picsys->DeleteBuffers(pic->i_planes, picsys->buffers);
free(picsys);
free(pic);
}
static picture_t *
......
......@@ -70,7 +70,6 @@ pool_pic_destroy_cb(picture_t *pic)
vdp_output_surface_destroy(p_sys->vdp, p_sys->surface);
vdp_release_x11(p_sys->vdp);
free(p_sys);
free(pic);
}
static picture_pool_t *
......
......@@ -202,7 +202,6 @@ static void DestroyPicture(picture_t *pic)
pl_buf_destroy(gpu, &picsys->buf);
vlc_vk_Release(picsys->vk);
free(picsys);
free(pic);
}
static picture_t *CreatePicture(vout_display_t *vd)
......
......@@ -67,7 +67,6 @@ static void PictureDestroy(picture_t *pic)
size_t picsize = pic->p[0].i_pitch * pic->p[0].i_lines;
munmap(pic->p[0].p_pixels, (picsize + pagemask) & ~pagemask);
free(pic);
}
static void buffer_release_cb(void *data, struct wl_buffer *buffer)
......
......@@ -567,7 +567,6 @@ static void DestroyDisplayPoolPicture(picture_t *picture)
picture_sys_t *p_sys = picture->p_sys;
ReleasePictureSys( p_sys );
free(p_sys);
free(picture);
}
#if !VLC_WINSTORE_APP
......
......@@ -217,7 +217,6 @@ static void DestroyPicture(picture_t *picture)
ReleasePictureSys(picture->p_sys);
free(picture->p_sys);
free(picture);
}
/**
......@@ -328,7 +327,7 @@ static picture_pool_t *Direct3D9CreatePicturePool(vlc_object_t *o,
error:
if (pool == NULL && pictures) {
for (unsigned i=0;i<picture_count; ++i)
DestroyPicture(pictures[i]);
picture_Release(pictures[i]);
}
free(pictures);
return pool;
......
......@@ -83,7 +83,6 @@ fail:
static void XCB_picture_SysV_Destroy (picture_t *pic)
{
shmdt (pic->p[0].p_pixels);
free (pic);
}
static int XCB_picture_SysV_Alloc(vout_display_t *vd, picture_resource_t *res,
......@@ -151,7 +150,6 @@ static int XCB_picture_SysV_Alloc(vout_display_t *vd, picture_resource_t *res,
static void XCB_picture_Destroy(picture_t *pic)
{
free(pic->p[0].p_pixels);
free(pic);
}
/**
......
......@@ -56,7 +56,6 @@ static void PictureDestroyContext( picture_t *p_picture )
static void picture_DestroyFromResource( picture_t *p_picture )
{
free( p_picture->p_sys );
free( p_picture );
}
/**
......@@ -68,7 +67,6 @@ static void picture_DestroyFromFormat(picture_t *pic)
if (res != NULL)
picture_Deallocate(res->fd, res->base, res->size);
free(pic);
}
VLC_WEAK void *picture_Allocate(int *restrict fdp, size_t size)
......@@ -331,6 +329,7 @@ void picture_Destroy(picture_t *picture)
picture_priv_t *priv = container_of(picture, picture_priv_t, picture);
assert(priv->gc.destroy != NULL);
priv->gc.destroy(picture);
free(priv);
}
/*****************************************************************************
......
......@@ -77,8 +77,6 @@ static void picture_pool_ReleasePicture(picture_t *clone)
unsigned offset = sys & (POOL_MAX - 1);
picture_t *picture = pool->picture[offset];
free(clone);
if (pool->pic_unlock != NULL)
pool->pic_unlock(picture);
picture_Release(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