[linux-cifs-client] [PATCH] cifs: add destroy routine for dns_resolver_key_type

Jeff Layton jlayton at redhat.com
Tue Aug 26 20:35:13 GMT 2008


Otherwise, we're leaking the payload memory.

Signed-off-by: Jeff Layton <jlayton at redhat.com>
---
 fs/cifs/dns_resolve.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c
index f730ef3..a2e0673 100644
--- a/fs/cifs/dns_resolve.c
+++ b/fs/cifs/dns_resolve.c
@@ -47,11 +47,18 @@ static int dns_resolver_instantiate(struct key *key, const void *data,
 	return rc;
 }
 
+static void
+dns_resolver_destroy(struct key *key)
+{
+	kfree(key->payload.data);
+}
+
 struct key_type key_type_dns_resolver = {
 	.name        = "dns_resolver",
 	.def_datalen = sizeof(struct in_addr),
 	.describe    = user_describe,
 	.instantiate = dns_resolver_instantiate,
+	.destroy     = dns_resolver_destroy,
 	.match       = user_match,
 };
 
-- 
1.5.5.1



More information about the linux-cifs-client mailing list