Message ID | 20220222065527.2581880-1-jiasheng@iscas.ac.cn |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] fftools/ffmpeg_filter: Add check for av_memdup | expand |
Context | Check | Description |
---|---|---|
andriy/make_aarch64_jetson | success | Make finished |
andriy/make_fate_aarch64_jetson | success | Make fate finished |
andriy/make_armv7_RPi4 | success | Make finished |
andriy/make_fate_armv7_RPi4 | success | Make fate finished |
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 2c3f21985f..cdaa0d8165 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1161,8 +1161,11 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame) av_freep(&ifilter->displaymatrix); sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX); - if (sd) + if (sd) { ifilter->displaymatrix = av_memdup(sd->data, sizeof(int32_t) * 9); + if (!ifilter->displaymatrix) + return AVERROR(ENOMEM); + } if (frame->hw_frames_ctx) { ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx);
As the potential failure of the av_malloc(), the av_memdup() could return NULL if fails. Therefore, it should be better to check it and return error if fails, like the av_buffer_ref(). Fixes: 535a835e51 ("ffmpeg: use display matrix frame side data for autorotation") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> --- fftools/ffmpeg_filter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)