提交 d951eea6 编写于 作者: H Haihao Xiang 提交者: Mark Thompson

hwcontext_vaapi: avoid fd leak in vaapi_device_derive

上级 9faae05d
......@@ -1678,8 +1678,13 @@ static int vaapi_device_derive(AVHWDeviceContext *ctx,
#endif
priv = av_mallocz(sizeof(*priv));
if (!priv)
if (!priv) {
if (fd != src_hwctx->fd) {
// The fd was opened in this function.
close(fd);
}
return AVERROR(ENOMEM);
}
if (fd == src_hwctx->fd) {
// The fd is inherited from the source context and we are holding
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册