]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- bug #452: fix crash on assert in mesh_state_attachment.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 11 Jun 2012 12:04:58 +0000 (12:04 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 11 Jun 2012 12:04:58 +0000 (12:04 +0000)
git-svn-id: file:///svn/unbound/trunk@2683 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/mesh.c

index 046a9947dce983ae37d16023af8aa43aff0413bc..3f3bfa97a7c54bd7bb1f4faf72babfcc30554a12 100644 (file)
@@ -1,3 +1,6 @@
+11 June 2012: Wouter
+       - bug #452: fix crash on assert in mesh_state_attachment.
+
 30 May 2012: Wouter
        - silence warning from swig-generated code (md set but not used in
          swig initmodule, due to ifdefs in swig-generated code).
index f6fd288adf828ccec793215062c645a5240d7627..d8ac310ef0fa851f3d158c0cb08d4b26cc58007f 100644 (file)
@@ -735,16 +735,20 @@ int mesh_state_attachment(struct mesh_state* super, struct mesh_state* sub)
        superref->s = super;
        subref->node.key = subref;
        subref->s = sub;
-#ifdef UNBOUND_DEBUG
-       n =
-#endif
-       rbtree_insert(&sub->super_set, &superref->node);
-       log_assert(n != NULL);
+       if(!rbtree_insert(&sub->super_set, &superref->node)) {
+               /* this should not happen, iterator and validator do not
+                * attach subqueries that are identical. */
+               /* already attached, we are done, nothing todo.
+                * since superref and subref already allocated in region,
+                * we cannot free them */
+               return 1;
+       }
 #ifdef UNBOUND_DEBUG
        n =
 #endif
        rbtree_insert(&super->sub_set, &subref->node);
-       log_assert(n != NULL);
+       log_assert(n != NULL); /* we checked above if statement, the reverse
+         administration should not fail now, unless they are out of sync */
        return 1;
 }