mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Fix oversight in previous error-reporting patch; mustn't pfree path string
before passing it to elog.
This commit is contained in:
parent
6e82501083
commit
f06b7604ca
@ -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)
|
|||||||
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)
|
|||||||
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)));
|
||||||
|
Loading…
Reference in New Issue
Block a user