diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-11-14 11:09:50 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-11-14 11:09:50 +0000 |
commit | f06b7604ca25dc7a27a636e81ed12229d53b8750 (patch) | |
tree | 9ec498c0aca27dddb3306ec4f389df47b47a194e /src | |
parent | 6e82501083b5d9e7d02fe0e099d70edcf8f793da (diff) | |
download | postgresql-f06b7604ca25dc7a27a636e81ed12229d53b8750.tar.gz postgresql-f06b7604ca25dc7a27a636e81ed12229d53b8750.zip |
Fix oversight in previous error-reporting patch; mustn't pfree path string
before passing it to elog.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/storage/smgr/md.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 2724f9ad84f..1a762eb5bc7 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -8,7 +8,7 @@ * * * 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) fd = PathNameOpenFile(path, O_RDWR | PG_BINARY, 0600); if (fd < 0) { - pfree(path); /* be sure to report the error reported by create, not open */ errno = save_errno; ereport(ERROR, @@ -499,10 +498,12 @@ mdopen(SMgrRelation reln, ForkNumber forknum, ExtensionBehavior behavior) fd = PathNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600); if (fd < 0) { - pfree(path); if (behavior == EXTENSION_RETURN_NULL && FILE_POSSIBLY_DELETED(errno)) + { + pfree(path); return NULL; + } ereport(ERROR, (errcode_for_file_access(), errmsg("could not open relation %s: %m", path))); |