summaryrefslogtreecommitdiff
path: root/libavcodec/mlz.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-11 16:22:16 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-18 20:11:06 +0100
commit3b08e046afe4fed2fa782c55fed82c18c9fef2c8 (patch)
treed27c82a2e42e3d86d291a7afbb7e4a2c389690a5 /libavcodec/mlz.c
parente925d5453b476017ef7aff60b66e98fb74168b2f (diff)
avcodec/alsdec, mlz: Check allocation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mlz.c')
-rw-r--r--libavcodec/mlz.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c
index dbeb7dcad9..9087ffd8f0 100644
--- a/libavcodec/mlz.c
+++ b/libavcodec/mlz.c
@@ -20,8 +20,11 @@
#include "mlz.h"
-av_cold void ff_mlz_init_dict(void* context, MLZ *mlz) {
+av_cold int ff_mlz_init_dict(void *context, MLZ *mlz)
+{
mlz->dict = av_mallocz(TABLE_SIZE * sizeof(*mlz->dict));
+ if (!mlz->dict)
+ return AVERROR(ENOMEM);
mlz->flush_code = FLUSH_CODE;
mlz->current_dic_index_max = DIC_INDEX_INIT;
@@ -30,6 +33,8 @@ av_cold void ff_mlz_init_dict(void* context, MLZ *mlz) {
mlz->next_code = FIRST_CODE;
mlz->freeze_flag = 0;
mlz->context = context;
+
+ return 0;
}
av_cold void ff_mlz_flush_dict(MLZ *mlz) {