Skip to content

Commit 2209c0f

Browse files
committed
Preserve errno across free().
Dept. of second thoughts: free() isn't guaranteed not to change errno. Make sure we report the right error if getcwd() fails.
1 parent 9aca512 commit 2209c0f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/port/path.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,10 @@ make_absolute_path(const char *path)
608608
}
609609
else
610610
{
611+
int save_errno = errno;
612+
611613
free(buf);
614+
errno = save_errno;
612615
#ifndef FRONTEND
613616
elog(ERROR, "could not get current working directory: %m");
614617
#else

0 commit comments

Comments
 (0)