File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/interfaces/ecpg/pgtypeslib Expand file tree Collapse file tree 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)
402402 numeric * numcopy = PGTYPESnumeric_new ();
403403 char * s ;
404404
405- if (dscale < 0 )
406- dscale = num -> dscale ;
405+ if (numcopy == NULL )
406+ return NULL ;
407407
408408 if (PGTYPESnumeric_copy (num , numcopy ) < 0 )
409409 {
410410 PGTYPESnumeric_free (numcopy );
411411 return NULL ;
412412 }
413+
414+ if (dscale < 0 )
415+ dscale = num -> dscale ;
416+
413417 /* get_str_from_var may change its argument */
414418 s = get_str_from_var (numcopy , dscale );
415419 PGTYPESnumeric_free (numcopy );
@@ -1493,6 +1497,9 @@ numericvar_to_double(numeric *var, double *dp)
14931497 char * endptr ;
14941498 numeric * varcopy = PGTYPESnumeric_new ();
14951499
1500+ if (varcopy == NULL )
1501+ return -1 ;
1502+
14961503 if (PGTYPESnumeric_copy (var , varcopy ) < 0 )
14971504 {
14981505 PGTYPESnumeric_free (varcopy );
You can’t perform that action at this time.
0 commit comments