From 2729401cc341668410f7d7b49971ce2fe6600e31 Mon Sep 17 00:00:00 2001 From: Cezar Sa Espinola Date: Fri, 29 Nov 2013 14:33:57 -0200 Subject: [PATCH] Fixed memory leak saving images as webp when webpmux is available --- _webp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_webp.c b/_webp.c index 2dab29fde..6381e1a56 100644 --- a/_webp.c +++ b/_webp.c @@ -113,11 +113,11 @@ PyObject* WebPEncode_wrapper(PyObject* self, PyObject* args) WebPMuxAssemble(mux, &output_data); WebPMuxDelete(mux); + free(output); - output = (uint8_t*)output_data.bytes; ret_size = output_data.size; if (ret_size > 0) { - PyObject *ret = PyBytes_FromStringAndSize((char*)output, ret_size); + PyObject *ret = PyBytes_FromStringAndSize((char*)output_data.bytes, ret_size); WebPDataClear(&output_data); return ret; }