Re: BUG #15105: OpenTransientFile() should be paired with CloseTransientFile() rather than close()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: bianpan2016(at)163(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: BUG #15105: OpenTransientFile() should be paired with CloseTransientFile() rather than close()
Date: 2018-03-09 14:57:48
Message-ID: 19686.1520607468@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> On Fri, Mar 09, 2018 at 03:29:25AM +0000, PG Bug reporting form wrote:
>> Details: The handler opened with OpenTransientFile() should be closed with
>> CloseTransientFile(). However, in function dsm_impl_mmap(), on a certain
>> path, the return value of OpenTransientFile() (at line 885) is passed to
>> close() (at line 926). It is better to use CloseTransientFile() here, as
>> done at line 909.

> Good catch! This is visibly a copy-paste error coming from
> dsm_impl_posix(). As a patch it gives the attached. I am adding also
> Robert in CC for awareness.

Presumably, this would have been found sooner if AtEOXact_Files acted
like most other end-of-xact cleanup functions and whined about leaked
resources (in the commit case). I wonder why it doesn't.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Meskes 2018-03-09 16:33:31 Re: BUG #15104: Double free in the main function in ecpg.c
Previous Message Mehdi Rahman 2018-03-09 10:51:49 Re: BUG #15102: Performance problem when doing join, index are not used