diff options
author | Steven Liu <liuqi05@kuaishou.com> | 2022-01-28 10:08:18 +0800 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2022-01-28 08:27:48 +0100 |
commit | 9887ec3e9bf81ad7680539d9361187dc4bcd2fb3 (patch) | |
tree | a51026043eb106bf4e91428e2b0da1f6f6de3221 | |
parent | f0044d886f0e02789976b786b9cc85c4dffa4da7 (diff) | |
download | ffmpeg-9887ec3e9bf81ad7680539d9361187dc4bcd2fb3.tar.gz |
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@kuaishou.com>
-rw-r--r-- | libavutil/tx.c | 7 |
1 files changed, 6 insertions, 1 deletions
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++) { |