mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
avutil/hwcontext_qsv: register free function for device_derive
When qsv device is created by device_derive, the ctx->free function is not registered, causing potential memory leak because of not properly closing the MFX session. Signed-off-by: Tong Wu <tong1.wu@intel.com> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
This commit is contained in:
parent
13a10fe892
commit
28ed898ac6
@ -2094,6 +2094,15 @@ static int qsv_device_derive(AVHWDeviceContext *ctx,
|
||||
AVDictionary *opts, int flags)
|
||||
{
|
||||
mfxIMPL impl;
|
||||
QSVDevicePriv *priv;
|
||||
|
||||
priv = av_mallocz(sizeof(*priv));
|
||||
if (!priv)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ctx->user_opaque = priv;
|
||||
ctx->free = qsv_device_free;
|
||||
|
||||
impl = choose_implementation("hw_any", child_device_ctx->type);
|
||||
return qsv_device_derive_from_child(ctx, impl,
|
||||
child_device_ctx, flags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user