1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Add a missing check for out-of-memory in the lemon code generator.

FossilOrigin-Name: efb20b9da6c7cb310a449cc818eaccd3d5bb4ab3
This commit is contained in:
drh
2011-06-02 15:48:51 +00:00
parent c9afea68ff
commit 070d422d31
3 changed files with 12 additions and 8 deletions

View File

@ -3434,6 +3434,10 @@ void print_stack_union(
/* Allocate and initialize types[] and allocate stddt[] */
arraysize = lemp->nsymbol * 2;
types = (char**)calloc( arraysize, sizeof(char*) );
if( types==0 ){
fprintf(stderr,"Out of memory.\n");
exit(1);
}
for(i=0; i<arraysize; i++) types[i] = 0;
maxdtlength = 0;
if( lemp->vartype ){
@ -3447,7 +3451,7 @@ void print_stack_union(
if( len>maxdtlength ) maxdtlength = len;
}
stddt = (char*)malloc( maxdtlength*2 + 1 );
if( types==0 || stddt==0 ){
if( stddt==0 ){
fprintf(stderr,"Out of memory.\n");
exit(1);
}