From aa8d16761b6e2dfe9a5c7596f07f96a9cd96dff1 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 25 Jan 1999 21:43:51 +0000 Subject: [PATCH] Make sure not to call realloc() with a NULL pointer -- call malloc() in that case. Tamito Kajiyama. --- Modules/cPickle.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/cPickle.c b/Modules/cPickle.c index a73a7874f5..d259471bc8 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; -- 2.50.1