Browse Source

hwcontext_vaapi: avoid fd leak in vaapi_device_derive

tags/n4.4
Haihao Xiang Mark Thompson 5 years ago
parent
commit
d951eea6fd
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      libavutil/hwcontext_vaapi.c

+ 6
- 1
libavutil/hwcontext_vaapi.c View File

@@ -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…
Cancel
Save