From: | "Zhang, Jie" <zhangjie2(at)cn(dot)fujitsu(dot)com> |
---|---|
To: | "Kuroda, Hayato" <kuroda(dot)hayato(at)fujitsu(dot)com>, "Matsumura, Ryo" <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 08:14:06 |
Message-ID: | 1396E95157071C4EBBA51892C5368521017F31249E@G08CNEXMBPEKD02.g08.fujitsu.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Kuroda,
>If your patch is committed, in your example, any operation for cur1 will not be accepted.
Although the return value after calling ecpg_get_con_name_by_cursor_name(cur1) is NULL,
in ecpg_get_connection(), actual_connection will be returned.
so, operation for cur1 will be accepted,
>p = ecpg_find_declared_statement(declared_name);
>if (p && p->cursor_name == cursor_name)
>p->cursor_name = ecpg_strdup(cursor_name, lineno);
Because the initial value of p->cursor_name is NULL, p->cursor_name will never be updated.
Best Regards!
-----Original Message-----
From: Kuroda, Hayato/\田 隼人
Sent: Tuesday, June 11, 2019 2:36 PM
To: Zhang, Jie/张 杰 <zhangjie2(at)cn(dot)fujitsu(dot)com>; Matsumura, Ryo/松村 量 <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>; pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: RE: [PATCH] memory leak in ecpglib
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
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2019-06-11 08:22:20 | Re: Hash join explain is broken |
Previous Message | Andres Freund | 2019-06-11 07:45:57 | Re: Hash join explain is broken |