mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-03 19:33:07 +03:00
fixed malloc check
This commit is contained in:
parent
fd0e7be55a
commit
539c5fdb5f
|
@ -2215,7 +2215,7 @@ void _font_text_asBytes(PyObject* encoded_string, unsigned char** text){
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
*text = calloc(len,1);
|
*text = calloc(len,1);
|
||||||
if (text) {
|
if (*text) {
|
||||||
memcpy(*text, buffer, len);
|
memcpy(*text, buffer, len);
|
||||||
}
|
}
|
||||||
if(bytes) {
|
if(bytes) {
|
||||||
|
@ -2231,7 +2231,7 @@ void _font_text_asBytes(PyObject* encoded_string, unsigned char** text){
|
||||||
if (PyString_Check(encoded_string)) {
|
if (PyString_Check(encoded_string)) {
|
||||||
PyString_AsStringAndSize(encoded_string, &buffer, &len);
|
PyString_AsStringAndSize(encoded_string, &buffer, &len);
|
||||||
*text = calloc(len,1);
|
*text = calloc(len,1);
|
||||||
if (text) {
|
if (*text) {
|
||||||
memcpy(*text, buffer, len);
|
memcpy(*text, buffer, len);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user