From 539c5fdb5fbb1dcf441212cb1a88985f2035d7ac Mon Sep 17 00:00:00 2001 From: wiredfool Date: Tue, 18 Jul 2017 02:58:24 -0700 Subject: [PATCH] fixed malloc check --- _imaging.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_imaging.c b/_imaging.c index 5e549a082..b6792290b 100644 --- a/_imaging.c +++ b/_imaging.c @@ -2215,7 +2215,7 @@ void _font_text_asBytes(PyObject* encoded_string, unsigned char** text){ if (len) { *text = calloc(len,1); - if (text) { + if (*text) { memcpy(*text, buffer, len); } if(bytes) { @@ -2231,7 +2231,7 @@ void _font_text_asBytes(PyObject* encoded_string, unsigned char** text){ if (PyString_Check(encoded_string)) { PyString_AsStringAndSize(encoded_string, &buffer, &len); *text = calloc(len,1); - if (text) { + if (*text) { memcpy(*text, buffer, len); } return;