pull up r19625 from trunk
authorTom Yu <tlyu@mit.edu>
Thu, 9 Aug 2007 22:11:07 +0000 (22:11 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 9 Aug 2007 22:11:07 +0000 (22:11 +0000)
 r19625@cathode-dark-space:  jaltman | 2007-06-22 14:55:46 -0400
 ticket: 5584

 1. When freeing a message type object, it should also be removed from
    the all_msg_types list.

 2. When a type handler is being removed from a message type, we
    shouldn't re-create the message type object if it has already been
    destroyed.

ticket: 5584

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19783 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/identity/kmq/msgtype.c

index b7ea21fcabd1cc704d7b2c65a54f7702eed51a3a..b5b23e9201bd70252f1885dbdea54160f97f0dbc 100644 (file)
@@ -104,6 +104,8 @@ void kmqint_free_msg_type(int t) {
 
     pt->completion_handler = NULL;
 
+    LDELETE(&all_msg_types, pt);
+
     PFREE(pt);
 }
 
@@ -374,8 +376,12 @@ khm_int32 kmqint_msg_type_set_handler(khm_int32 type, kmq_msg_completion_handler
     if (type == KMSG_SYSTEM)
         return KHM_ERROR_INVALID_PARAM;
 
-    if(!msg_types[type])
-        kmqint_msg_type_create(type);
+    if(!msg_types[type]) {
+        if (handler)
+            kmqint_msg_type_create(type);
+        else
+            return KHM_ERROR_SUCCESS;
+    }
 
     if(!msg_types[type])
         return KHM_ERROR_NO_RESOURCES;