From 851449edfc1746a3ad63260db825ab3a2b23d331 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 24 Sep 2024 19:14:26 +1000 Subject: [PATCH] Free memory on early return --- src/libImaging/SgiRleDecode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libImaging/SgiRleDecode.c b/src/libImaging/SgiRleDecode.c index a8db11740..c285637dd 100644 --- a/src/libImaging/SgiRleDecode.c +++ b/src/libImaging/SgiRleDecode.c @@ -195,6 +195,7 @@ ImagingSgiRleDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t } _imaging_seek_pyFd(state->fd, SGI_HEADER_SIZE, SEEK_SET); if (_imaging_read_pyFd(state->fd, (char *)ptr, c->bufsize) != c->bufsize) { + free(ptr); state->errcode = IMAGING_CODEC_UNKNOWN; return -1; }