summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-07-16 15:06:13 (GMT)
committerGuido van Rossum <guido@python.org>1998-07-16 15:06:13 (GMT)
commit0fd00334c676e680818453eee50a7998889e6ca9 (patch)
tree471323b513327f3ba331adc21ce2431c89e02017 /Objects/dictobject.c
parent93d1fe1c56444e06e704582ddbf6ba77deadc0fd (diff)
downloadcpython-0fd00334c676e680818453eee50a7998889e6ca9.zip
cpython-0fd00334c676e680818453eee50a7998889e6ca9.tar.gz
cpython-0fd00334c676e680818453eee50a7998889e6ca9.tar.bz2
Avoid using calloc(). This triggered an obscure bug on multiprocessor
Sparc Solaris 2.6 (fully patched!) that I don't want to dig into, but which I suspect is a bug in the multithreaded malloc library that only shows up when run on a multiprocessor. (The program wasn't using threads, it was just using the multithreaded C library.)
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 7fed379..7b62258 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -283,11 +283,12 @@ dictresize(mp, minused)
break;
}
}
- newtable = (dictentry *) calloc(sizeof(dictentry), newsize);
+ newtable = (dictentry *) malloc(sizeof(dictentry) * newsize);
if (newtable == NULL) {
PyErr_NoMemory();
return -1;
}
+ memset(newtable, '\0', sizeof(dictentry) * newsize);
mp->ma_size = newsize;
mp->ma_poly = newpoly;
mp->ma_table = newtable;