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
16781678 #endif
16791679
16801680 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+ }
16821686 return AVERROR(ENOMEM);
1687+ }
16831688
16841689 if (fd == src_hwctx->fd) {
16851690 // 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