[PATCH 06/16] sm-notify command: getaddrinfo(3) addrinfo leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

 utils/statd/sm-notify.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index 5a02394..b69f4cc 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -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,

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux