diff options
-rw-r--r-- | Modules/cPickle.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c index a73a787..d259471 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -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; |