Re: Help needed for the resolution of memory leak

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Sasmit Utkarsh <utkarshsasmit(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Help needed for the resolution of memory leak
Date: 2024-01-15 20:00:10
Message-ID: CAHyXU0wmjF=3qmR5NZtpZMTKM958Nhsb022Yz0TGHFMO5VH=9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jan 15, 2024 at 11:32 AM Sasmit Utkarsh <utkarshsasmit(at)gmail(dot)com>
wrote:

> Hi Team,
>
> I am trying to test a code which basically tries to read some data from
> postgresql db in a loop through a function SQL_get_tpf_rw() whose
> definition and other details are shared in the attached file along with the
> memory leak report resulted during testing. Could you let me know if i
> missed calling anywhere PQclear()
> in SQL_get_tpf_rw() which resulted in the below .
>
> Last few lines from the report
>
>
yep: for example,

if (PQresultStatus(*res*) != PGRES_TUPLES_OK)
{
LOG_ERROR("SELECT failed: %s", PQerrorMessage(conn));
LOG_DEBUG("ROLLBACK TRANSACTION AND CHAIN");
*res* = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN");
LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa);
rc = ERR_INVALID_FILE_ADDRESS;

See highlighted bits. You're reusing the res object before clearing
it. there may be other cases, but this jumped off the page.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lan Xu 2024-01-15 20:04:46 Re: Help with "Create Extension unaccent"
Previous Message Justin Clift 2024-01-15 19:43:20 Re: Moving to Postgresql database