Commit 0fd00334 authored by Guido van Rossum's avatar Guido van Rossum

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.)
parent 93d1fe1c
...@@ -283,11 +283,12 @@ dictresize(mp, minused) ...@@ -283,11 +283,12 @@ dictresize(mp, minused)
break; break;
} }
} }
newtable = (dictentry *) calloc(sizeof(dictentry), newsize); newtable = (dictentry *) malloc(sizeof(dictentry) * newsize);
if (newtable == NULL) { if (newtable == NULL) {
PyErr_NoMemory(); PyErr_NoMemory();
return -1; return -1;
} }
memset(newtable, '\0', sizeof(dictentry) * newsize);
mp->ma_size = newsize; mp->ma_size = newsize;
mp->ma_poly = newpoly; mp->ma_poly = newpoly;
mp->ma_table = newtable; mp->ma_table = newtable;
......
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