mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
Fix some minor infelicities in ecpg's pgtypeslib: (1) `pstr' must be
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.
This commit is contained in:
parent
898a7bd13b
commit
9fad4cb604
@ -2669,8 +2669,7 @@ pgtypes_defmt_scan(union un_fmt_comb * scan_val, int scan_type, char **pstr, cha
|
|||||||
if (!pstr_end)
|
if (!pstr_end)
|
||||||
{
|
{
|
||||||
/* there was an error, no match */
|
/* there was an error, no match */
|
||||||
err = 1;
|
return 1;
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
last_char = *pstr_end;
|
last_char = *pstr_end;
|
||||||
*pstr_end = '\0';
|
*pstr_end = '\0';
|
||||||
@ -2699,8 +2698,10 @@ pgtypes_defmt_scan(union un_fmt_comb * scan_val, int scan_type, char **pstr, cha
|
|||||||
err = 1;
|
err = 1;
|
||||||
break;
|
break;
|
||||||
case PGTYPES_TYPE_STRING_MALLOCED:
|
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)
|
if (strtol_end && *strtol_end)
|
||||||
*pstr = strtol_end;
|
*pstr = strtol_end;
|
||||||
|
Loading…
Reference in New Issue
Block a user