thanks to andreas moroder
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"));
+ }
}
/****************************************************************************
}
while (!buf && size>0) {
- buf = (char *)Realloc(buf,size+8);
+ buf = (char *)malloc(buf,size+8);
if (!buf) size /= 2;
}
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;