[Patch #974633] Check PyObject_MALLOC return for error

This commit is contained in:
Andrew M. Kuchling 2004-06-29 14:03:04 +00:00
parent 6d3a0d2dff
commit 93b4b88e96
2 changed files with 5 additions and 0 deletions

View File

@ -143,6 +143,7 @@ Yves Dionne
Daniel Dittmar
Walter Dörwald
Jaromir Dolecek
Dima Dorfman
Cesar Douady
Dean Draayer
Fred L. Drake, Jr.

View File

@ -69,6 +69,10 @@ fixstate(grammar *g, state *s)
int nl = g->g_ll.ll_nlabels;
s->s_accept = 0;
accel = (int *) PyObject_MALLOC(nl * sizeof(int));
if (accel == NULL) {
fprintf(stderr, "no mem to build parser accelerators\n");
exit(1);
}
for (k = 0; k < nl; k++)
accel[k] = -1;
a = s->s_arc;