Currently send_ua() does not call libnet_destroy() on the handle
that it creates using libnet_init() resulting in some memory leakage.

Index: heartbeat-ipv6addr/resources/OCF/IPv6addr.c
===================================================================
--- heartbeat-ipv6addr.orig/resources/OCF/IPv6addr.c    2007-04-13 
15:35:21.000000000 +0900
+++ heartbeat-ipv6addr/resources/OCF/IPv6addr.c 2007-04-13 15:40:39.000000000 
+0900
@@ -378,6 +378,7 @@
 int
 send_ua(struct in6_addr* src_ip, char* if_name)
 {
+       int status = -1;
        libnet_t *l;
        char errbuf[LIBNET_ERRBUF_SIZE];
 
@@ -388,13 +389,13 @@
 
        if ((l=libnet_init(LIBNET_RAW6, if_name, errbuf)) == NULL) {
                cl_log(LOG_ERR, "libnet_init failure on %s", if_name);
-               return -1;
+               goto err;
        }
 
        mac_address = libnet_get_hwaddr(l);
        if (!mac_address) {
                cl_log(LOG_ERR, "libnet_get_hwaddr: %s", errbuf);
-               return -1;
+               goto err;
        }
 
        dst_ip = libnet_name2addr6(l, BCAST_ADDR, LIBNET_DONT_RESOLVE);
@@ -415,10 +416,13 @@
         if (libnet_write(l) == -1)
         {
                cl_log(LOG_ERR, "libnet_write: %s", libnet_geterror(l));
-               return -1;
+               goto err;
        }
 
-       return 0;
+       status = -1;
+err:
+       libnet_destroy(l);
+       return status;
 }
 
 /* find a proper network interface to assign the address */

--

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

_______________________________________________________
Linux-HA-Dev: [EMAIL PROTECTED]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to