Commit 75859b6f authored by Guido van Rossum's avatar Guido van Rossum

Make sure not to call realloc() with a NULL pointer -- call malloc()

in that case.  Tamito Kajiyama.
parent 3bd9373c
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment