1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

s3: VFS: Protect errno if sys_getwd() fails across free() call.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13069

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2017-10-03 10:58:00 -07:00 committed by Ralph Boehme
parent fb9ce0685e
commit 4800ed3595

View File

@ -594,7 +594,9 @@ char *sys_getwd(void)
break;
}
if (errno != ERANGE) {
int saved_errno = errno;
SAFE_FREE(s);
errno = saved_errno;
break;
}
allocated *= 2;
@ -612,7 +614,9 @@ char *sys_getwd(void)
}
wd = getwd(s);
if (wd == NULL) {
int saved_errno = errno;
SAFE_FREE(s);
errno = saved_errno;
}
return wd;
#endif