]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
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 5a023949191ad160e1edb8f57a06f97b7cf445df..b69f4cca886cd19086ee14496acc2c0f083a48e3 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,