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:
9209c35
)
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
Karolin Seeger
<kseeger@samba.org>
Wed, 25 Oct 2017 06:43:02 +0000
(08:43 +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>
(cherry picked from commit
fb9ce0685e5d46e3d7abf5fac07b4f626339a413
)
source3/lib/system.c
patch
|
blob
|
history
diff --git
a/source3/lib/system.c
b/source3/lib/system.c
index 99462b631c790763ae2be4a90191dbf5499d9f20..01c934277acb6f31653eab9d39aea2eb028cf999 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
}