History

libavcodec/videotoolbox_vp9: Move av_malloc() to avoid memory leak

Move av_malloc() after the check for subsampling to avoid memory leak if subsampling < 0 and av_malloc() succeeds.

Jiasheng Jiang committed 1 year ago

Commit 8b4e6cc1 parent d5040b51 file · +3 −3Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/videotoolbox_vp9.c+3−3
@@ -71,12 +71,12 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx) · 70 unmodified lines
7171 uint8_t *vt_extradata;
7272 int subsampling = get_vpx_chroma_subsampling(avctx->sw_pix_fmt, avctx->chroma_sample_location);
7373
74− vt_extradata_size = 1 + 3 + 6 + 2;
75− vt_extradata = av_malloc(vt_extradata_size);
76−
7774 if (subsampling < 0)
7875 return NULL;
7976
77+ vt_extradata_size = 1 + 3 + 6 + 2;
78+ vt_extradata = av_malloc(vt_extradata_size);
79+
8080 if (!vt_extradata)
8181 return NULL;
8282

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