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

Unified · Split

libavcodec/videotoolbox_vp9.c+3−3
@@ -71,12 +71,12 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx) · 70 unmodified lines
71 uint8_t *vt_extradata;71 uint8_t *vt_extradata;
72 int subsampling = get_vpx_chroma_subsampling(avctx->sw_pix_fmt, avctx->chroma_sample_location);72 int subsampling = get_vpx_chroma_subsampling(avctx->sw_pix_fmt, avctx->chroma_sample_location);
73 73
74 vt_extradata_size = 1 + 3 + 6 + 2;
75 vt_extradata = av_malloc(vt_extradata_size);
76
77 if (subsampling < 0)74 if (subsampling < 0)
78 return NULL;75 return NULL;
79 76
77 vt_extradata_size = 1 + 3 + 6 + 2;
78 vt_extradata = av_malloc(vt_extradata_size);
79
80 if (!vt_extradata)80 if (!vt_extradata)
81 return NULL;81 return NULL;
82 82

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