RE: [PATCH] memory leak in ecpglib

From: "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "zhangjie2(at)cn(dot)fujitsu(dot)com" <zhangjie2(at)cn(dot)fujitsu(dot)com>, "matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: [PATCH] memory leak in ecpglib
Date: 2019-06-11 06:35:36
Message-ID: OSAPR01MB20049FB3DB4734A8BC428171F5ED0@OSAPR01MB2004.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2019-06-11 06:36:55 Re: pgbench rate limiting changes transaction latency computation
Previous Message Andres Freund 2019-06-11 06:11:15 check_recovery_target_lsn() does a PG_CATCH without a throw