History

hwcontext_vaapi: avoid fd leak in vaapi_device_derive

Haihao Xiang committed 6 years ago

Commit d951eea1 parent 9faae051 file · +6 −1Browse files

Unified · Split

libavutil/hwcontext_vaapi.c+6−1
@@ -1678,8 +1678,13 @@ static int vaapi_device_derive(AVHWDeviceContext *ctx, · 1677 unmodified lines
1678#endif1678#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 holding1690 // The fd is inherited from the source context and we are holding

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t