aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-03-15 13:08:54 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-03-19 00:18:36 +0100
commit0d629c390ea7a51ffe35b08cff692046ec3efd4d (patch)
tree84ec591289794b7bd937f6b17d65a6c83122d00f
parentaaa3868b10fc01e82021a7f271976a4f5398dac2 (diff)
downloadffmpeg-0d629c390ea7a51ffe35b08cff692046ec3efd4d.tar.gz
avcodec/zlib_wrapper: Use our allocation, freeing functions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/zlib_wrapper.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/zlib_wrapper.c b/libavcodec/zlib_wrapper.c
index b15d5be2b8..5b93c2c74f 100644
--- a/libavcodec/zlib_wrapper.c
+++ b/libavcodec/zlib_wrapper.c
@@ -23,8 +23,19 @@
#include "libavutil/error.h"
#include "libavutil/log.h"
+#include "libavutil/mem.h"
#include "zlib_wrapper.h"
+static void *alloc_wrapper(void *opaque, uInt items, uInt size)
+{
+ return av_malloc_array(items, size);
+}
+
+static void free_wrapper(void *opaque, void *ptr)
+{
+ av_free(ptr);
+}
+
int ff_inflate_init(FFZStream *z, void *logctx)
{
z_stream *const zstream = &z->zstream;
@@ -33,8 +44,8 @@ int ff_inflate_init(FFZStream *z, void *logctx)
z->inited = 0;
zstream->next_in = Z_NULL;
zstream->avail_in = 0;
- zstream->zalloc = Z_NULL;
- zstream->zfree = Z_NULL;
+ zstream->zalloc = alloc_wrapper;
+ zstream->zfree = free_wrapper;
zstream->opaque = Z_NULL;
zret = inflateInit(zstream);