diff options
author | Simo Sorce <idra@samba.org> | 2001-08-05 10:10:16 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-08-05 10:10:16 +0000 |
commit | e485a1a4986c9328754b9a8b3054b8a6738b54f0 (patch) | |
tree | e769aabf19f50ce524b26584b1de5dee00a6ae7d /source3/lib/util_file.c | |
parent | efe1d83dbbe8492f0077b2c354eb087e53e42cd7 (diff) | |
download | samba-e485a1a4986c9328754b9a8b3054b8a6738b54f0.tar.gz samba-e485a1a4986c9328754b9a8b3054b8a6738b54f0.tar.bz2 samba-e485a1a4986c9328754b9a8b3054b8a6738b54f0.zip |
Some fixes about malloc/Realloc and mem leak
thanks to andreas moroder
(This used to be commit b29a549cdd85d42a1697041ab04f0ae4eddd23ca)
Diffstat (limited to 'source3/lib/util_file.c')
-rw-r--r-- | source3/lib/util_file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 01a8b1c333..a92eb15333 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -282,13 +282,15 @@ char *fgets_slash(char *s2,int maxlen,FILE *f) if (feof(f)) return(NULL); + if (maxlen <2) return(NULL); + if (!s2) { maxlen = MIN(maxlen,8); s = (char *)Realloc(s,maxlen); } - if (!s || maxlen < 2) return(NULL); + if (!s) return(NULL); *s = 0; |