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; }