Commit f06b7604 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Fix oversight in previous error-reporting patch; mustn't pfree path string

before passing it to elog.
parent 6e825010
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.140 2008/11/11 13:19:16 heikki Exp $ * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.141 2008/11/14 11:09:50 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -253,7 +253,6 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo) ...@@ -253,7 +253,6 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
fd = PathNameOpenFile(path, O_RDWR | PG_BINARY, 0600); fd = PathNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
if (fd < 0) if (fd < 0)
{ {
pfree(path);
/* be sure to report the error reported by create, not open */ /* be sure to report the error reported by create, not open */
errno = save_errno; errno = save_errno;
ereport(ERROR, ereport(ERROR,
...@@ -499,10 +498,12 @@ mdopen(SMgrRelation reln, ForkNumber forknum, ExtensionBehavior behavior) ...@@ -499,10 +498,12 @@ mdopen(SMgrRelation reln, ForkNumber forknum, ExtensionBehavior behavior)
fd = PathNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600); fd = PathNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
if (fd < 0) if (fd < 0)
{ {
pfree(path);
if (behavior == EXTENSION_RETURN_NULL && if (behavior == EXTENSION_RETURN_NULL &&
FILE_POSSIBLY_DELETED(errno)) FILE_POSSIBLY_DELETED(errno))
{
pfree(path);
return NULL; return NULL;
}
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not open relation %s: %m", path))); errmsg("could not open relation %s: %m", path)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment