Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit440953e

Browse files
committed
Tom, happier with the attached patch?
I'd have to disagree with regards to the memory leaks not being wortha mention - any such leak can cause problems when the PostgreSQLinstallation is either unattended, long-living andor has very highconnection levels. Half a kilobyte on start-up isn't negligible inthis light.Regards, Lee.Tom Lane writes: > Lee Kindness <lkindness@csl.co.uk> writes: > > Guys, attached is a patch to fix two memory leaks on start-up. > > I do not like the changes to miscinit.c. In the first place, it is not > a "memory leak" to do a one-time allocation of state for a proc_exit > function. A bigger complaint is that your proposed change introduces > fragile coupling between CreateLockFile and its callers, in order to > save no resources worth mentioning. More, it introduces an assumption > that the globals directoryLockFile and socketLockFile don't change while > the postmaster is running. UnlinkLockFile should unlink the file that > it was originally told to unlink, regardless of what happens to those > globals. > > If you are intent on spending code to free stuff just before the > postmaster exits, a better fix would be for UnlinkLockFile to free its > string argument after using it.Lee Kindness
1 parent51e46d1 commit440953e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎src/backend/utils/init/miscinit.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.105 2003/07/25 20:17:52 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.106 2003/07/27 19:39:13 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -685,8 +685,15 @@ GetUserNameFromId(AclId userid)
685685
staticvoid
686686
UnlinkLockFile(intstatus,Datumfilename)
687687
{
688-
unlink((char*)DatumGetPointer(filename));
689-
/* Should we complain if the unlink fails? */
688+
char*fname= (char*)DatumGetPointer(filename);
689+
if(fname!=NULL )
690+
{
691+
if(unlink(fname)!=0 )
692+
{
693+
/* Should we complain if the unlink fails? */
694+
}
695+
free(fname);
696+
}
690697
}
691698

692699
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp