Skip to content

Commit f06b760

Browse files
committed
Fix oversight in previous error-reporting patch; mustn't pfree path string
before passing it to elog.
1 parent 6e82501 commit f06b760

File tree

1 file changed

+4
-3
lines changed
  • src/backend/storage/smgr

1 file changed

+4
-3
lines changed

src/backend/storage/smgr/md.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.140 2008/11/11 13:19:16 heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.141 2008/11/14 11:09:50 heikki Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -253,7 +253,6 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
253253
fd = PathNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
254254
if (fd < 0)
255255
{
256-
pfree(path);
257256
/* be sure to report the error reported by create, not open */
258257
errno = save_errno;
259258
ereport(ERROR,
@@ -499,10 +498,12 @@ mdopen(SMgrRelation reln, ForkNumber forknum, ExtensionBehavior behavior)
499498
fd = PathNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
500499
if (fd < 0)
501500
{
502-
pfree(path);
503501
if (behavior == EXTENSION_RETURN_NULL &&
504502
FILE_POSSIBLY_DELETED(errno))
503+
{
504+
pfree(path);
505505
return NULL;
506+
}
506507
ereport(ERROR,
507508
(errcode_for_file_access(),
508509
errmsg("could not open relation %s: %m", path)));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy