Use calloc-based functions, not malloc. (GH-19152)

This commit is contained in:
Andy Lester 2020-03-24 23:26:44 -05:00 committed by GitHub
parent 7dd549eb08
commit 7668a8bc93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 38 deletions

View file

@ -206,12 +206,11 @@ PyInterpreterState_New(void)
return NULL;
}
PyInterpreterState *interp = PyMem_RawMalloc(sizeof(PyInterpreterState));
PyInterpreterState *interp = PyMem_RawCalloc(1, sizeof(PyInterpreterState));
if (interp == NULL) {
return NULL;
}
memset(interp, 0, sizeof(*interp));
interp->id_refcount = -1;
_PyRuntimeState *runtime = &_PyRuntime;