[PATCH] Add error message for out-of-memory in passwordFromFile()

Поиск
Список
Период
Сортировка
От Joshua Shanks
Тема [PATCH] Add error message for out-of-memory in passwordFromFile()
Дата
Msg-id CAOxqWDfihFRmhNVdfu8epYTXQRxkCHSOrg+=-ij2c_X3gW=o3g@mail.gmail.com
обсуждение исходный текст
Ответы Re: [PATCH] Add error message for out-of-memory in passwordFromFile()
Список pgsql-hackers
Hi,

I noticed a XXX comment in fe-connect.c at line 8064 indicating that an error message would be nice when strdup() fails while reading the password file. Currently, passwordFromFile() silently returns NULL on allocation failure, leaving users without feedback on what went wrong.

This patch adds proper error reporting by:

1. Adding a PGconn *conn parameter to passwordFromFile() to enable error reporting via libpq_append_conn_error()
2. Reporting "out of memory" when strdup() fails, following the pattern used by other OOM handlers in fe-connect.c

The conn parameter is placed first, consistent with the object-oriented convention used throughout libpq (see connectOptions1, fillPGconn, store_conn_addrinfo, etc.).

Cheers,
Joshua
Вложения

В списке pgsql-hackers по дате отправления: