Hi,

I've found a strange piece of code. The print_stack_union function
allocates some memory to the types variable (line 3436) and terminates
with an error code if this allocation fails (line 3450). But types is
already accessed before this check. So shouldn't the check be earlier
in the code, or am I missing something?

Cheers,
Ronald

3436: types = (char**)calloc( arraysize, sizeof(char*) );
                        for(i=0; i<arraysize; i++) types[i] = 0;
                        maxdtlength = 0;
                        if( lemp->vartype ){
                        maxdtlength = lemonStrlen(lemp->vartype);
                        }
                        for(i=0; i<lemp->nsymbol; i++){
                int len;
                struct symbol *sp = lemp->symbols[i];
                if( sp->datatype==0 ) continue;
                len = lemonStrlen(sp->datatype);
                if( len>maxdtlength ) maxdtlength = len;
                }
                stddt = (char*)malloc( maxdtlength*2 + 1 );
3450: if( types==0 || stddt==0 ){
                fprintf(stderr,"Out of memory.\n");
                exit(1);
                }
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to