r15050: fixed a double free in the new messaging code.
authorAndrew Tridgell <tridge@samba.org>
Wed, 12 Apr 2006 09:38:07 +0000 (09:38 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:04:03 +0000 (14:04 -0500)
(This used to be commit ee7869bb3c901fb91efedc8208aa56df927987c5)

source4/lib/messaging/messaging.c

index f8f998f5cf1ed503f29e9664c1d605c33102f80c..c02a79ab8dde095e0950d390dcbc201845fbb56e 100644 (file)
@@ -364,12 +364,12 @@ void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void
        }       
 
        /* the list base possibly changed */
-       if (list == NULL) {
-               if (msg_type >= msg->num_types) {
+       if (msg_type >= msg->num_types) {
+               if (list == NULL) {
                        idr_remove(msg->dispatch_tree, msg_type);
-               } else {
-                       msg->dispatch[msg_type] = NULL;
                }
+       } else {
+               msg->dispatch[msg_type] = list;
        }
 }