1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

libpq: pass a memory allocation failure error up to PQconndefaults()

Previously user name memory allocation failures were ignored and the
default user name set to NULL.
This commit is contained in:
Bruce Momjian
2014-03-20 11:48:31 -04:00
parent d1bdab2fa3
commit a4c8f14364
2 changed files with 16 additions and 7 deletions

View File

@ -4482,6 +4482,13 @@ conninfo_add_defaults(PQconninfoOption *options, PQExpBuffer errorMessage)
if (strcmp(option->keyword, "user") == 0)
{
option->val = pg_fe_getauthname();
if (!option->val)
{
if (errorMessage)
printfPQExpBuffer(errorMessage,
libpq_gettext("out of memory\n"));
return false;
}
continue;
}
}