BUG #16273: InitDB Memory leak

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

The following bug has been logged on the website:

Bug reference: 16273
Logged by: sun qiankun
Email address: sunqiankun@highgo.com
PostgreSQL version: 12.1
Operating system: centos7
Description:

when i read the code in src/bin/initdb/initdb.c.
At the function: set_info_version, we use pg_strdup to malloc memory, but
we don't free it.

Detail info:
char *vstr = pg_strdup(PG_VERSION);

we can fix it at the end of the function use free(vstr).

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: BUG #16273: InitDB Memory leak

PG Bug reporting form <noreply@postgresql.org> writes:

when i read the code in src/bin/initdb/initdb.c.
At the function: set_info_version, we use pg_strdup to malloc memory, but
we don't free it.

There are lots of minor memory leaks in initdb. We don't really care
that much, because the program executes over a fixed set of data and
then terminates.

regards, tom lane