git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d774aeb
)
s3: VFS: Ensure sys_getwd() doesn't leak memory on error on really old systems.
author
Jeremy Allison
<jra@samba.org>
Tue, 3 Oct 2017 17:37:55 +0000
(10:37 -0700)
committer
Ralph Boehme
<slow@samba.org>
Wed, 4 Oct 2017 08:06:15 +0000
(10:06 +0200)
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>
source3/lib/system.c
patch
|
blob
|
history
diff --git
a/source3/lib/system.c
b/source3/lib/system.c
index 70ddf6a4dea0e5be2b52567585c8cb7d5cca828d..5baa8f7d3ff0e841389d0e430508350e94902045 100644
(file)
--- a/
source3/lib/system.c
+++ b/
source3/lib/system.c
@@
-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
}