Free interface correctly when removed
authorHenning Rogge <hrogge@googlemail.com>
Sun, 5 Jul 2009 17:37:10 +0000 (19:37 +0200)
committerHenning Rogge <hrogge@googlemail.com>
Sun, 5 Jul 2009 17:37:10 +0000 (19:37 +0200)
src/interfaces.c
src/unix/ifnet.c

index beb1f95..8899234 100644 (file)
@@ -292,6 +292,9 @@ remove_interface(struct interface **pinterf)
 
   unlock_interface(ifp);
 
+  free(ifp->int_name);
+  olsr_cookie_free(interface_mem_cookie, ifp);
+
   if (list_is_empty(&interface_head) && !olsr_cnf->allow_no_interfaces) {
     OLSR_ERROR(LOG_INTERFACE, "No more active interfaces - exiting.\n");
     olsr_exit(EXIT_FAILURE);
index 162a6cd..7fae56c 100644 (file)
@@ -522,8 +522,7 @@ chk_if_up(struct olsr_if_config *iface)
   /*
    * Clone interface name.
    */
-  ifp->int_name = olsr_malloc(strlen(ifr_basename) + 1, "Interface update 3");
-  strcpy(ifp->int_name, ifr_basename);
+  ifp->int_name = olsr_strdup(ifr_basename);
 
   ifp->immediate_send_tc = iface->cnf->tc_params.emission_interval < iface->cnf->hello_params.emission_interval;
 #if 0