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:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user