Skip to content

Commit

Permalink
Fix for CONPY-273:
Browse files Browse the repository at this point in the history
Fixed crash in escape_string method of connection object:
Instead of PyMem_RawCalloc we allocate memory via PyMem_Calloc, since
the memory will be freed by PyMem_Free (instead of PyMem_RawFree).
  • Loading branch information
9EOR9 committed Nov 22, 2023
1 parent f269345 commit f9adb73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mariadb/mariadb_connection.c
Expand Up @@ -874,7 +874,7 @@ static PyObject *MrdbConnection_escape_string(MrdbConnection *self,
return NULL;

from= (char *)PyUnicode_AsUTF8AndSize(string, (Py_ssize_t *)&from_length);
if (!(to= (char *)PyMem_RawCalloc(1, from_length * 2 + 1)))
if (!(to= (char *)PyMem_Calloc(1, from_length * 2 + 1)))
{
return NULL;
}
Expand Down

0 comments on commit f9adb73

Please sign in to comment.