diff options
author | Ben Morss <morss@google.com> | 2021-05-26 11:21:46 -0400 |
---|---|---|
committer | Ben Morss <morss@google.com> | 2021-05-26 11:21:46 -0400 |
commit | cba26d7fc6793e5875322fc8e778ecbfbe88a962 (patch) | |
tree | 5f9bb2f3914291a7686d33324f7928156ac15802 /src/gd_avif.c | |
parent | 82d260950589563a1af9c56f4ce5fde843a695ae (diff) | |
download | libgd-cba26d7fc6793e5875322fc8e778ecbfbe88a962.tar.gz |
Fix memory leak
libavif will use this function as a callback.
Using libavif's memory allocators gives libavif a chance to release this memory when it's finished with it.
Diffstat (limited to 'src/gd_avif.c')
-rw-r--r-- | src/gd_avif.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gd_avif.c b/src/gd_avif.c index 2090661..56103f6 100644 --- a/src/gd_avif.c +++ b/src/gd_avif.c @@ -191,7 +191,7 @@ static avifResult readFromCtx(avifIO *io, uint32_t readFlags, uint64_t offset, s if (!ctx->seek(ctx, (int) offset)) return AVIF_RESULT_IO_ERROR; - dataBuf = gdMalloc(size); + dataBuf = avifMalloc(size); if (!dataBuf) { gd_error("avif error - couldn't allocate memory"); return AVIF_RESULT_UNKNOWN_ERROR; @@ -201,7 +201,7 @@ static avifResult readFromCtx(avifIO *io, uint32_t readFlags, uint64_t offset, s // If getBuf() returns a negative value, that means there was an error. int charsRead = ctx->getBuf(ctx, dataBuf, (int) size); if (charsRead < 0) { - gdFree(dataBuf); + avifFree(dataBuf); return AVIF_RESULT_IO_ERROR; } |