Unified · Split
| @@ -1678,8 +1678,13 @@ static int vaapi_device_derive(AVHWDeviceContext *ctx, · 1677 unmodified lines | |||
| 1678 | #endif | 1678 | #endif |
| 1679 | 1679 | ||
| 1680 | priv = av_mallocz(sizeof(*priv)); | 1680 | priv = av_mallocz(sizeof(*priv)); |
| 1681 | if (!priv) | 1681 | if (!priv) { |
| 1682 | if (fd != src_hwctx->fd) { | ||
| 1683 | // The fd was opened in this function. | ||
| 1684 | close(fd); | ||
| 1685 | } | ||
| 1682 | return AVERROR(ENOMEM); | 1686 | return AVERROR(ENOMEM); |
| 1687 | } | ||
| 1683 | 1688 | ||
| 1684 | if (fd == src_hwctx->fd) { | 1689 | if (fd == src_hwctx->fd) { |
| 1685 | // The fd is inherited from the source context and we are holding | 1690 | // The fd is inherited from the source context and we are holding |