diff --git a/src/_image_wrapper.cpp b/src/_image_wrapper.cpp index d0c56d34f21f..a064a4a82569 100644 --- a/src/_image_wrapper.cpp +++ b/src/_image_wrapper.cpp @@ -177,8 +177,8 @@ static PyObject *PyImage_color_conv(PyImage *self, PyObject *args, PyObject *kwd free(buff)); PyObject *result = PyByteArray_FromStringAndSize((const char *)buff, size); + free(buff); if (result == NULL) { - free(buff); return NULL; }