BUG #16921: small memory leak

Started by PG Bug reporting formabout 5 years ago3 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 16921
Logged by: Geo Sil
Email address: rekgrpth@gmail.com
PostgreSQL version: 13.2
Operating system: ubuntu
Description:

Is there a small memory leak here?
file: postgres/src/pl/plpgsql/src/pl_handler.c
function: plpgsql_extra_checks_check_hook
code: myextra = (int *) malloc(sizeof(int));
I don't find freeing memory.
But I suggest do it in functions plpgsql_extra_warnings_assign_hook and
plpgsql_extra_errors_assign_hook

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: PG Bug reporting form (#1)
Re: BUG #16921: small memory leak

Hi

čt 11. 3. 2021 v 12:04 odesílatel PG Bug reporting form <
noreply@postgresql.org> napsal:

The following bug has been logged on the website:

Bug reference: 16921
Logged by: Geo Sil
Email address: rekgrpth@gmail.com
PostgreSQL version: 13.2
Operating system: ubuntu
Description:

Is there a small memory leak here?
file: postgres/src/pl/plpgsql/src/pl_handler.c
function: plpgsql_extra_checks_check_hook
code: myextra = (int *) malloc(sizeof(int));
I don't find freeing memory.
But I suggest do it in functions plpgsql_extra_warnings_assign_hook and
plpgsql_extra_errors_assign_hook

if I understand to source code, then it is released in function
set_extra_field in file guc.c

Regards

Pavel

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Stehule (#2)
Re: BUG #16921: small memory leak

Pavel Stehule <pavel.stehule@gmail.com> writes:

čt 11. 3. 2021 v 12:04 odesílatel PG Bug reporting form <
noreply@postgresql.org> napsal:

Is there a small memory leak here?
file: postgres/src/pl/plpgsql/src/pl_handler.c

if I understand to source code, then it is released in function
set_extra_field in file guc.c

Yeah, a GUC variable's "extra" storage is managed by guc.c. It
would be completely wrong for those plpgsql routines to free it.

regards, tom lane