Re: leak in libpq, getpwuid

From: Michael Nacos <m(dot)nacos(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: leak in libpq, getpwuid
Date: 2009-10-22 13:22:16
Message-ID: 407fa4640910220622l1e803747s5eb36f9c5178e203@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

just to say I have run into related problems on debian lenny amd64 (postgres
8.3.5, libc-2.7) and centos 5.2 (postgres 8.4.1, libc-2.5)

code as simple as this:

#include <libpq-fe.h>

int main()
{
PGconn *connection = PQconnectdb("user=postgres");
PQfinish(connection);
return 0;
}

gives (run through valgrind --leak-check=full):

==13832==
==13832== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 19 from 2)
==13832== malloc/free: in use at exit: 292 bytes in 11 blocks.
==13832== malloc/free: 131 allocs, 120 frees, 51,532 bytes allocated.
==13832== For counts of detected errors, rerun with: -v
==13832== searching for pointers to 11 not-freed blocks.
==13832== checked 703,248 bytes.
==13832==
==13832== 292 (52 direct, 240 indirect) bytes in 1 blocks are definitely
lost in loss record 1 of 3
==13832== at 0x4C2260E: malloc (vg_replace_malloc.c:207)
==13832== by 0x512852F: (within /lib/libc-2.7.so)
==13832== by 0x5128D06: __nss_database_lookup (in /lib/libc-2.7.so)
==13832== by 0x82A931F: ???
==13832== by 0x82AA02C: ???
==13832== by 0x50E7101: getpwuid_r (in /lib/libc-2.7.so)
==13832== by 0x4E41D38: (within /usr/lib/libpq.so.5.1)
==13832== by 0x4E2E50C: (within /usr/lib/libpq.so.5.1)
==13832== by 0x4E3258F: (within /usr/lib/libpq.so.5.1)
==13832== by 0x4E3260B: (within /usr/lib/libpq.so.5.1)
==13832== by 0x4E32F98: PQconnectStart (in /usr/lib/libpq.so.5.1)
==13832== by 0x4E32FE5: PQconnectdb (in /usr/lib/libpq.so.5.1)
==13832==
==13832== LEAK SUMMARY:
==13832== definitely lost: 52 bytes in 1 blocks.
==13832== indirectly lost: 240 bytes in 10 blocks.
==13832== possibly lost: 0 bytes in 0 blocks.
==13832== still reachable: 0 bytes in 0 blocks.
==13832== suppressed: 0 bytes in 0 blocks.

and

==9466== Invalid free() / delete / delete[]
==9466== at 0x4020FDA: free (vg_replace_malloc.c:233)
==9466== by 0x4158A2D: free_mem (in /lib/libc-2.5.so)
==9466== by 0x41585A6: __libc_freeres (in /lib/libc-2.5.so)
==9466== by 0x401D1E6: _vgnU_freeres (vg_preloaded.c:60)
==9466== by 0x40D9C63: _Exit (in /lib/libc-2.5.so)
==9466== by 0x405EDF3: (below main) (in /lib/libc-2.5.so)
==9466== Address 0x401C8F8 is not stack'd, malloc'd or (recently) free'd
==9466==
==9466== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 45 from 1)
==9466== malloc/free: in use at exit: 0 bytes in 0 blocks.
==9466== malloc/free: 136 allocs, 137 frees, 49,272 bytes allocated.

cheers, Michael

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kaori Inaba 2009-10-22 13:30:22 PostgreSQL Conference 2009 Japan : Schedule available and registration open
Previous Message Jayaraman, Rajaram (STSD) 2009-10-22 12:44:09 FATAL error could not find function "alt_to_mic" in file cyrillic_and_mic.so