Fix badly ordered dequeue in hna_delete
authorHenning Rogge <hrogge@googlemail.com>
Wed, 6 Jan 2010 19:51:13 +0000 (20:51 +0100)
committerHenning Rogge <hrogge@googlemail.com>
Wed, 6 Jan 2010 19:51:13 +0000 (20:51 +0100)
src/hna_set.c

index c5b1758..887fcfa 100644 (file)
@@ -228,6 +228,8 @@ olsr_delete_hna_net_entry(struct hna_net *net_to_delete) {
    */
   olsr_delete_routing_table(&net_to_delete->A_network_addr, net_to_delete->prefixlen, &hna_gw->A_gateway_addr);
 
+  DEQUEUE_ELEM(net_to_delete);
+
   /* Delete hna_gw if empty */
   if (hna_gw->networks.next == &hna_gw->networks) {
     DEQUEUE_ELEM(hna_gw);
@@ -235,7 +237,6 @@ olsr_delete_hna_net_entry(struct hna_net *net_to_delete) {
     removed_entry = true;
   }
 
-  DEQUEUE_ELEM(net_to_delete);
   olsr_cookie_free(hna_net_mem_cookie, net_to_delete);
   return removed_entry;
 }