[FFmpeg-cvslog] avutil/tx: add null pointer check after av_mallocz
Steven Liu
git at videolan.org
Fri Jan 28 09:28:37 EET 2022
ffmpeg | branch: master | Steven Liu <liuqi05 at kuaishou.com> | Fri Jan 28 10:08:18 2022 +0800| [9887ec3e9bf81ad7680539d9361187dc4bcd2fb3] | committer: Lynne
avutil/tx: add null pointer check after av_mallocz
Fix CID: 1497863
there will get null pointer in attempt to initialize each if alloc memory failed.
Signed-off-by: Steven Liu <liuqi05 at kuaishou.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9887ec3e9bf81ad7680539d9361187dc4bcd2fb3
---
libavutil/tx.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavutil/tx.c b/libavutil/tx.c
index 50616adba7..06e8958283 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -565,8 +565,13 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
print_cd_info(cd_matches[i].cd, cd_matches[i].prio, 1);
}
- if (!s->sub)
+ if (!s->sub) {
s->sub = sub = av_mallocz(TX_MAX_SUB*sizeof(*sub));
+ if (!sub) {
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
+ }
/* Attempt to initialize each */
for (int i = 0; i < nb_cd_matches; i++) {
More information about the ffmpeg-cvslog
mailing list