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 | b29a549cdd85d42a1697041ab04f0ae4eddd23ca (patch) | |
tree | 72890a2eb8519fb51d5209293ccdf9cb40426cd7 /source/lib/messages.c | |
parent | b4f06c3ecf8af60352bc9e3af9c35c00827faad2 (diff) | |
download | samba-b29a549cdd85d42a1697041ab04f0ae4eddd23ca.tar.gz samba-b29a549cdd85d42a1697041ab04f0ae4eddd23ca.tar.xz samba-b29a549cdd85d42a1697041ab04f0ae4eddd23ca.zip |
Some fixes about malloc/Realloc and mem leak
thanks to andreas moroder
Diffstat (limited to 'source/lib/messages.c')
-rw-r--r-- | source/lib/messages.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/lib/messages.c b/source/lib/messages.c index 78cd3e22bc2..54f6321041a 100644 --- a/source/lib/messages.c +++ b/source/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")); + } } /**************************************************************************** |