File tree 1 file changed +9
-2
lines changed
src/interfaces/ecpg/pgtypeslib 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -402,14 +402,18 @@ PGTYPESnumeric_to_asc(numeric *num, int dscale)
402
402
numeric * numcopy = PGTYPESnumeric_new ();
403
403
char * s ;
404
404
405
- if (dscale < 0 )
406
- dscale = num -> dscale ;
405
+ if (numcopy == NULL )
406
+ return NULL ;
407
407
408
408
if (PGTYPESnumeric_copy (num , numcopy ) < 0 )
409
409
{
410
410
PGTYPESnumeric_free (numcopy );
411
411
return NULL ;
412
412
}
413
+
414
+ if (dscale < 0 )
415
+ dscale = num -> dscale ;
416
+
413
417
/* get_str_from_var may change its argument */
414
418
s = get_str_from_var (numcopy , dscale );
415
419
PGTYPESnumeric_free (numcopy );
@@ -1493,6 +1497,9 @@ numericvar_to_double(numeric *var, double *dp)
1493
1497
char * endptr ;
1494
1498
numeric * varcopy = PGTYPESnumeric_new ();
1495
1499
1500
+ if (varcopy == NULL )
1501
+ return -1 ;
1502
+
1496
1503
if (PGTYPESnumeric_copy (var , varcopy ) < 0 )
1497
1504
{
1498
1505
PGTYPESnumeric_free (varcopy );
You can’t perform that action at this time.
0 commit comments