mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 06:42:03 +00:00
vd_lavc: fix a small memory leak on init error
The private context wasn't free'd when codec init failed. Restructure the code so that it can't happen.
This commit is contained in:
parent
053196de84
commit
c2592be4f0
@ -122,7 +122,6 @@ void video_uninit(struct dec_video *d_video)
|
||||
MP_VERBOSE(d_video, "Uninit video.\n");
|
||||
d_video->vd_driver->uninit(d_video);
|
||||
}
|
||||
talloc_free(d_video->priv);
|
||||
vf_destroy(d_video->vfilter);
|
||||
talloc_free(d_video);
|
||||
}
|
||||
|
@ -62,8 +62,6 @@ static int get_buffer2_hwdec(AVCodecContext *avctx, AVFrame *pic, int flags);
|
||||
static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
|
||||
const enum AVPixelFormat *pix_fmt);
|
||||
|
||||
static void uninit(struct dec_video *vd);
|
||||
|
||||
#define OPT_BASE_STRUCT struct vd_lavc_params
|
||||
|
||||
struct vd_lavc_params {
|
||||
@ -254,6 +252,11 @@ static struct vd_lavc_hwdec *probe_hwdec(struct dec_video *vd, bool autoprobe,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void uninit(struct dec_video *vd)
|
||||
{
|
||||
uninit_avctx(vd);
|
||||
talloc_free(vd->priv);
|
||||
}
|
||||
|
||||
static int init(struct dec_video *vd, const char *decoder)
|
||||
{
|
||||
@ -439,11 +442,6 @@ static void uninit_avctx(struct dec_video *vd)
|
||||
av_frame_free(&ctx->pic);
|
||||
}
|
||||
|
||||
static void uninit(struct dec_video *vd)
|
||||
{
|
||||
uninit_avctx(vd);
|
||||
}
|
||||
|
||||
static void update_image_params(struct dec_video *vd, AVFrame *frame,
|
||||
struct mp_image_params *out_params)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user