Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6B5E6B5DBCD for ; Wed, 28 Sep 2011 19:22:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 82696-04 for ; Wed, 28 Sep 2011 22:22:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id B2472B5DBC0 for ; Wed, 28 Sep 2011 19:22:12 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p8SMMCtv033291 for ; Wed, 28 Sep 2011 22:22:12 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p8SMMCsH033290; Wed, 28 Sep 2011 22:22:12 GMT (envelope-from www) Date: Wed, 28 Sep 2011 22:22:12 GMT Message-Id: <201109282222.p8SMMCsH033290@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6234: Memory leak from PQexec From: "Vikas Mehta" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201109/225 X-Sequence-Number: 31242 The following bug has been logged online: Bug reference: 6234 Logged by: Vikas Mehta Email address: mehta@roguewave.com PostgreSQL version: 8.4.8 Operating system: Windows Description: Memory leak from PQexec Details: Purify shows 448 bytes of memory leaks with PQexec: [W] Summary of all memory leaks... {448 bytes, 11 blocks} [W] MLK: Memory leak of 128 bytes from 1 block allocated in ERR_load_SSL_strings [SSLEAY32.DLL] [W] MLK: Memory leak of 128 bytes from 1 block allocated in PQrequestCancel [LIBPQ.DLL] [W] MLK: Memory leak of 128 bytes from 1 block allocated in ENGINE_load_ubsec [LIBEAY32.DLL] [W] MLK: Memory leak of 64 bytes from 8 blocks allocated in add_error_table [COMERR32.DLL] Test case: ========== #include #include #include #include void createTestTable(PGconn* dbc) { PGresult *res; printf("\n\nCreating Test Table.....\n"); res = PQexec(dbc, "create table mytable (col1 int)"); if (PQresultStatus(res) == PGRES_NONFATAL_ERROR || PQresultStatus(res) == PGRES_FATAL_ERROR) { printf("!!!!! Failed to create test table.\n"); } PQclear(res); } void dropTestTable(PGconn* dbc) { PGresult *res; printf("\n\nDropping Test Table.....\n"); res = PQexec(dbc, "drop table mytable"); if (PQresultStatus(res) == PGRES_NONFATAL_ERROR || PQresultStatus(res) == PGRES_FATAL_ERROR) { printf("!!!!! Failed to drop test table.\n"); } PQclear(res); } int main() { PGconn *dbc; dbc = PQconnectdb("host = magma.cvo.roguewave.com user = username password = pwd dbname = db"); if(dbc == 0 || PQstatus(dbc) == CONNECTION_BAD) { printf("!!!!! Failed to establish connection.\n"); } createTestTable(dbc); dropTestTable(dbc); PQfinish(dbc); return 0; }