sm-notify command: getaddrinfo(3) addrinfo leak
authorChuck Lever <chuck.lever@oracle.com>
Fri, 26 Sep 2008 17:21:43 +0000 (13:21 -0400)
committerSteve Dickson <steved@redhat.com>
Fri, 26 Sep 2008 17:21:43 +0000 (13:21 -0400)
Make sure the results of getaddrinfo(3) are properly freed in notify().

Note this is a one-time addrinfo allocation that would be automatically
freed when sm-notify exits anyway, so this is more of a nit than a real
bug fix.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/statd/sm-notify.c

index 5a02394..b69f4cc 100644 (file)
@@ -241,8 +241,11 @@ notify(void)
                                opt_srcaddr);
                        exit(1);
                }
-               memcpy(&local_addr, ai->ai_addr, ai->ai_addrlen);
+
                /* We know it's IPv4 at this point */
+               memcpy(&local_addr, ai->ai_addr, ai->ai_addrlen);
+
+               freeaddrinfo(ai);
        }
 
        /* Use source port if provided on the command line,