mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
s3: VFS: Ensure sys_getwd() doesn't leak memory on error on really old systems.
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:
parent
d774aeba5e
commit
fb9ce0685e
@ -605,11 +605,16 @@ char *sys_getwd(void)
|
||||
}
|
||||
return wd;
|
||||
#else
|
||||
char *wd = NULL;
|
||||
char *s = SMB_MALLOC_ARRAY(char, PATH_MAX);
|
||||
if (s == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return getwd(s);
|
||||
wd = getwd(s);
|
||||
if (wd == NULL) {
|
||||
SAFE_FREE(s);
|
||||
}
|
||||
return wd;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user