Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Mar 2010 20:25:29 +0800
From:      Earl Lapus <earl.lapus@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   [ping6] freeaddrinfo()
Message-ID:  <604f76121003130425u62764f59wa88b398f15540b61@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hi,

I was browsing through the ping6 code and I noticed that one
particular call to getaddrinfo() didn't have a freeaddrinfo() pair.
All calls to getaddrinfo() should have an equivalent freeaddrinfo(), right?

Attached is a patch that "tries-to-resolve" this very small issue
(applies cleanly on an 8.0p2 kernel source).
Also, I'm not not 100% sure if that is the correct place to call
freeaddrinfo() - I hope someone on the list would be kind enough to
have look.

Cheers!

-- 
There are seven words in this sentence.

[-- Attachment #2 --]
diff -ruN ../src/sbin/ping6/ping6.c ../src.mod/sbin/ping6/ping6.c
--- ../src/sbin/ping6/ping6.c	2009-10-25 09:10:29.000000000 +0800
+++ ../src.mod/sbin/ping6/ping6.c	2010-03-13 19:46:45.000000000 +0800
@@ -635,6 +635,8 @@
 	    res->ai_protocol)) < 0)
 		err(1, "socket");
 
+	freeaddrinfo(res);
+
 	/* set the source address if specified. */
 	if ((options & F_SRCADDR) &&
 	    bind(s, (struct sockaddr *)&src, srclen) != 0) {

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?604f76121003130425u62764f59wa88b398f15540b61>