From 5545d21b7bc94cb8aea2ac7eaef29a44f24e7cf8 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 31 Oct 2015 03:30:15 -0400 Subject: [PATCH] Fix leak in PyImage_color_conv. The input buffer is copied internally when PyByteArray_FromStringAndSize is called, so it doesn't need to stay around. --- src/_image_wrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }