Skip to content

Commit 798062b

Browse files
committed
Use avif memory allocators
Using avifAlloc() here means that libavif has a chance to also free this memory block, which it does in places like avifIOMemoryReaderDestroy().
1 parent 85a3451 commit 798062b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/gd/libgd/gd_avif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static avifResult readFromCtx(avifIO *io, uint32_t readFlags, uint64_t offset, s
176176
if (!ctx->seek(ctx, offset))
177177
return AVIF_RESULT_IO_ERROR;
178178

179-
dataBuf = gdMalloc(size);
179+
dataBuf = avifAlloc(size);
180180
if (!dataBuf) {
181181
zend_error(E_ERROR, "avif error - couldn't allocate memory");
182182
return AVIF_RESULT_UNKNOWN_ERROR;
@@ -186,7 +186,7 @@ static avifResult readFromCtx(avifIO *io, uint32_t readFlags, uint64_t offset, s
186186
// If getBuf() returns a negative value, that means there was an error.
187187
int charsRead = ctx->getBuf(ctx, dataBuf, size);
188188
if (charsRead < 0) {
189-
gdFree(dataBuf);
189+
avifFree(dataBuf);
190190
return AVIF_RESULT_IO_ERROR;
191191
}
192192

0 commit comments

Comments
 (0)