numeric *numcopy = PGTYPESnumeric_new();
char *s;
- if (dscale < 0)
- dscale = num->dscale;
+ if (numcopy == NULL)
+ return NULL;
if (PGTYPESnumeric_copy(num, numcopy) < 0)
{
PGTYPESnumeric_free(numcopy);
return NULL;
}
+
+ if (dscale < 0)
+ dscale = num->dscale;
+
/* get_str_from_var may change its argument */
s = get_str_from_var(numcopy, dscale);
PGTYPESnumeric_free(numcopy);
char *endptr;
numeric *varcopy = PGTYPESnumeric_new();
+ if (varcopy == NULL)
+ return -1;
+
if (PGTYPESnumeric_copy(var, varcopy) < 0)
{
PGTYPESnumeric_free(varcopy);