mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Make sure not to call realloc() with a NULL pointer -- call malloc()
in that case. Tamito Kajiyama.
This commit is contained in:
parent
11801859e0
commit
aa8d16761b
1 changed files with 4 additions and 1 deletions
|
@ -3275,7 +3275,10 @@ load_mark(Unpicklerobject *self) {
|
|||
if ((self->num_marks + 1) >= self->marks_size) {
|
||||
s=self->marks_size+20;
|
||||
if (s <= self->num_marks) s=self->num_marks + 1;
|
||||
self->marks =(int *)realloc(self->marks, s * sizeof(int));
|
||||
if (self->marks)
|
||||
self->marks=(int *)malloc(s * sizeof(int));
|
||||
else
|
||||
self->marks=(int *)realloc(self->marks, s * sizeof(int));
|
||||
if (! self->marks) {
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue