BUG #16273: InitDB Memory leak

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG #16273: InitDB Memory leak

PG Doc comments form
The following bug has been logged on the website:

Bug reference:      16273
Logged by:          sun qiankun
Email address:      [hidden email]
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).

Reply | Threaded
Open this post in threaded view
|

Re: BUG #16273: InitDB Memory leak

Tom Lane-2
PG Bug reporting form <[hidden email]> 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