@@ -1414,15 +1414,23 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
1414
1414
unsigned long rl, ml;
1415
1415
my_bool b = false ;
1416
1416
1417
- n = MY_MIN (n, args->arg_count );
1417
+ n = MY_MIN (n, args->arg_count );
1418
1418
1419
1419
for (uint i = 0 ; i < n; i++)
1420
1420
if (IsJson (args, i) == 2 ||
1421
- (b == (m && !i && args->arg_type [0 ] == STRING_RESULT && !IsJson (args, 0 )))) {
1421
+ (b = (m && !i && args->arg_type [0 ] == STRING_RESULT && !IsJson (args, 0 )))) {
1422
1422
if (CalcLen (args, obj, rl, ml, mod))
1423
1423
return true ;
1424
- else if (b)
1425
- ml += args->lengths [0 ] * M; // Was not done in CalcLen
1424
+ else if (b) {
1425
+ ulong len;
1426
+ char *p = args->args [0 ];
1427
+
1428
+ // Is this a file name?
1429
+ if (strchr (" [{ \t\r\n " , *p) || !(len = GetFileLength (p)))
1430
+ len = args->lengths [0 ];
1431
+
1432
+ ml += len * M; // Was not done in CalcLen
1433
+ } // endif b
1426
1434
1427
1435
if (ml > g->Sarea_Size ) {
1428
1436
free (g->Sarea );
@@ -3813,8 +3821,6 @@ char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result,
3813
3821
} else if (initid->const_item )
3814
3822
g->N = 1 ;
3815
3823
3816
- PlugSubSet (g, g->Sarea , g->Sarea_Size );
3817
-
3818
3824
if ((n = IsJson (args, 0 )) == 3 ) {
3819
3825
// Get default file name and pretty
3820
3826
PBSON bsp = (PBSON)args->args [0 ];
0 commit comments