summaryrefslogtreecommitdiff
path: root/Python/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 05ac6e9ee5..fe9e000418 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -514,17 +514,17 @@ r_object(p)
PyErr_SetString(PyExc_ValueError, "bad marshal data");
return NULL;
}
- buffer = (char *)Py_Malloc(n);
+ buffer = PyMem_NEW(char, n);
if (buffer == NULL)
- return NULL;
+ return PyErr_NoMemory();
if (r_string(buffer, (int)n, p) != n) {
- free(buffer);
+ PyMem_DEL(buffer);
PyErr_SetString(PyExc_EOFError,
"EOF read where object expected");
return NULL;
}
v = PyUnicode_DecodeUTF8(buffer, n, NULL);
- free(buffer);
+ PyMem_DEL(buffer);
return v;
}