diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index c7ffe74c760..2b56e5c3d2f 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -178,18 +178,18 @@ static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf) /****************************************************************************/ PQRYRES DBFColumns(PGLOBAL g, const char *fn, BOOL info) { - static int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING, - TYPE_INT, TYPE_INT, TYPE_SHORT}; - static XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, - FLD_PREC, FLD_LENGTH, FLD_SCALE}; - static unsigned int length[] = {11, 6, 8, 10, 10, 6}; + int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING, + TYPE_INT, TYPE_INT, TYPE_SHORT}; + XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, + FLD_PREC, FLD_LENGTH, FLD_SCALE}; + unsigned int length[] = {11, 6, 8, 10, 10, 6}; char buf[2], filename[_MAX_PATH]; int ncol = sizeof(buftyp) / sizeof(int); int rc, type, len, field, fields; BOOL bad; DBFHEADER mainhead; DESCRIPTOR thisfield; - FILE *infile; + FILE *infile = NULL; PQRYRES qrp; PCOLRES crp; @@ -228,8 +228,12 @@ PQRYRES DBFColumns(PGLOBAL g, const char *fn, BOOL info) qrp = PlgAllocResult(g, ncol, fields, IDS_COLUMNS + 3, buftyp, fldtyp, length, true, false); - if (info || !qrp) + if (info || !qrp) { + if (infile) + fclose(infile); + return qrp; + } // endif info if (trace) { htrc("Structure of %s\n", filename); diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index de5f4a1004b..5e10c0a6846 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -218,7 +218,8 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, if (type == TYPE_DECIM) prec = ((Field_new_decimal*)fp)->precision; else - prec = (prec == NOT_FIXED_DEC) ? 0 : fp->field_length; + prec = fp->field_length; +// prec = (prec(???) == NOT_FIXED_DEC) ? 0 : fp->field_length; len = fp->char_length(); fmt = NULL;