non-NULL in this function, so there is no need to check for it (2) we
should check the return value of pgtypes_strdup(). Patch from Eric
Astor at EnterpriseDB, with slight cleanup by myself, per a report
from the Coverity tool.
if (!pstr_end)
{
/* there was an error, no match */
- err = 1;
- return err;
+ return 1;
}
last_char = *pstr_end;
*pstr_end = '\0';
err = 1;
break;
case PGTYPES_TYPE_STRING_MALLOCED:
- if (pstr)
- scan_val->str_val = pgtypes_strdup(*pstr);
+ scan_val->str_val = pgtypes_strdup(*pstr);
+ if (scan_val->str_val == NULL)
+ err = 1;
+ break;
}
if (strtol_end && *strtol_end)
*pstr = strtol_end;