mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
hwcontext_vaapi: avoid fd leak in vaapi_device_derive
This commit is contained in:
parent
9faae05ddf
commit
d951eea6fd
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user