Thread: BUG #16273: InitDB Memory leak

BUG #16273: InitDB Memory leak

From
PG Bug reporting form
Date:
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).


Re: BUG #16273: InitDB Memory leak

From
Tom Lane
Date:
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