Cure for segmentation fault in libpq

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Cure for segmentation fault in libpq
Дата
Msg-id 199803262232.WAA16269@linda.lfix.co.uk
обсуждение исходный текст
Ответы Re: [HACKERS] Cure for segmentation fault in libpq  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
I have been troubled by a segmentation fault when reloading from a dumpall.
This has been happening when a second \connect is encountered.

The faulty code was in fe-connect.c, where the memory for the user password
was freed, but the pointer itself was not set to NULL.  Later, the memory was
reused and the password appeared not to be empty, so that an attempt was
made to reference it.

Here is the patch:
diff -c postgresql-6.3.1{.orig,}/src/interfaces/libpq/fe-connect.c
*** postgresql-6.3.1.orig/src/interfaces/libpq/fe-connect.c     Thu Feb 26
04:44:59 1998
--- postgresql-6.3.1/src/interfaces/libpq/fe-connect.c  Thu Mar 26 18:45:23
1998
***************
*** 667,672 ****
--- 667,673 ----
        if (conn->pgpass != NULL)
        {
                free(conn->pgpass);
+               conn->pgpass = NULL;
        }

        return CONNECTION_OK;

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver

PGP key from public servers; key ID 32B8FAA1



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Reference Guide
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Cure for segmentation fault in libpq