Re: Avoid possible memory leak (src/common/rmtree.c)

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid possible memory leak (src/common/rmtree.c)
Date: 2023-07-29 02:54:48
Message-ID: ZMR/eCCVxaFYcL0s@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 25, 2023 at 04:45:22PM +0200, Daniel Gustafsson wrote:
> Skimming the tree there doesn't seem to be any callers which aren't exiting or
> ereporting on failure so the real-world impact seems low. That being said,
> silencing static analyzers could be reason enough to delay allocation.

A different reason would be out-of-core code that uses rmtree() in a
memory context where the leak would be an issue if facing a failure
continuously? Delaying the allocation after the OPENDIR() seems like
a good practice anyway.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2023-07-29 03:05:08 Re: Row pattern recognition
Previous Message Michael Paquier 2023-07-29 02:48:33 Re: Support worker_spi to execute the function dynamically.