Re: [PATCH] Fix potential memoryleak in guc.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Zhang, Jie" <zhangjie2(at)cn(dot)fujitsu(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Fix potential memoryleak in guc.c
Date: 2019-06-10 02:12:46
Message-ID: 8849.1560132766@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Zhang, Jie" <zhangjie2(at)cn(dot)fujitsu(dot)com> writes:
> In src\backend\utils\misc\guc.c, I found a potential memory leak.
> make_absolute_path() return a malloc'd copy, we should free memory before the function return false.

If SelectConfigFiles were executed more than once per postmaster
launch, this might be worth adding code for ... but as-is, I'm
dubious. There are a few tens of KB of other one-time leaks
that we don't worry about removing.

Even more to the point, the particular code path you're complaining
about is a failure exit that will lead to immediate process
termination, so there really is no point in adding code there.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2019-06-10 04:57:14 pg_upgrade: prep_status doesn't translate messages
Previous Message Ian Barwick 2019-06-10 02:06:54 doc: clarify "pg_signal_backend" default role