RE: [PATCH] memory leak in ecpglib - Mailing list pgsql-hackers

From kuroda.hayato@fujitsu.com
Subject RE: [PATCH] memory leak in ecpglib
Date
Msg-id OSAPR01MB20049FB3DB4734A8BC428171F5ED0@OSAPR01MB2004.jpnprd01.prod.outlook.com
Whole thread Raw
In response to RE: [PATCH] memory leak in ecpglib  ("Zhang, Jie" <zhangjie2@cn.fujitsu.com>)
List pgsql-hackers
Dear Zhang,

# I resend the email

Thank you for reporting a bug. I didn't care about this case.

>> We should free p->cursor_name before p->cursor_name = 
>> ecpg_strdup(cursor_name, lineno).

I'm wondering whether this approach is correct or not.
If your patch is committed, in your example, any operation for cur1 will not be accepted.

My idea is changing ecpg_update_declare_statement() for permitting one-to-many relation between a declared name and
cursors.
An example is as below:

p = ecpg_find_declared_statement(declared_name);
if (p && p->cursor_name == cursor_name)
    p->cursor_name = ecpg_strdup(cursor_name, lineno);

Do you have any suggestions or comments for this?

Best Regards,
Hayato Kuroda
Fujitsu LIMITED

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: check_recovery_target_lsn() does a PG_CATCH without a throw
Next
From: Fabien COELHO
Date:
Subject: Re: pgbench rate limiting changes transaction latency computation