diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/messages.c | 15 | ||||
-rw-r--r-- | source3/lib/util.c | 2 | ||||
-rw-r--r-- | source3/lib/util_file.c | 4 |
3 files changed, 15 insertions, 6 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c index 78cd3e22bc..54f6321041 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -322,12 +322,19 @@ void message_register(int msg_type, dfn = (struct dispatch_fns *)malloc(sizeof(*dfn)); - ZERO_STRUCTP(dfn); + if (dfn != NULL) { - dfn->msg_type = msg_type; - dfn->fn = fn; + ZERO_STRUCTPN(dfn); - DLIST_ADD(dispatch_fns, dfn); + dfn->msg_type = msg_type; + dfn->fn = fn; + + DLIST_ADD(dispatch_fns, dfn); + } + else { + + DEBUG(0,("message_register: Not enough memory. malloc failed!\n")); + } } /**************************************************************************** diff --git a/source3/lib/util.c b/source3/lib/util.c index 282e0e43fa..86c93e5ad0 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -524,7 +524,7 @@ SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n,char *header,int headlen, } while (!buf && size>0) { - buf = (char *)Realloc(buf,size+8); + buf = (char *)malloc(buf,size+8); if (!buf) size /= 2; } 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; |