netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: Fix memory leak in ah6.c
@ 2004-05-28 10:50 Patrick McHardy
  2004-05-29 19:37 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick McHardy @ 2004-05-28 10:50 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

Hi Dave,

this patch fixes a memory leak in ah6.c. iph is not freed when
ipv6_clear_mutable_options fails.

Regards
Patrick

[-- Attachment #2: ah6-memleak.diff --]
[-- Type: text/x-patch, Size: 874 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/05/28 12:21:37+02:00 kaber@trash.net 
#   [IPSEC]: Fix memory leak in ah6.c
# 
# net/ipv6/ah6.c
#   2004/05/28 12:21:29+02:00 kaber@trash.net +3 -1
#   [IPSEC]: Fix memory leak in ah6.c
# 
diff -Nru a/net/ipv6/ah6.c b/net/ipv6/ah6.c
--- a/net/ipv6/ah6.c	2004-05-28 12:34:25 +02:00
+++ b/net/ipv6/ah6.c	2004-05-28 12:34:25 +02:00
@@ -190,7 +190,7 @@
 		memcpy(skb->nh.ipv6h, iph, hdr_len);
 		nexthdr = ipv6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_OUT);
 		if (nexthdr == 0)
-			goto error;
+			goto error_free_iph;
 
 		skb->nh.raw[nh_offset] = IPPROTO_AH;
 		skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
@@ -239,6 +239,8 @@
 		goto error_nolock;
 	}
 	return NET_XMIT_BYPASS;
+error_free_iph:
+	kfree(iph);
 error:
 	spin_unlock_bh(&x->lock);
 error_nolock:

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-29 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-28 10:50 [PATCH]: Fix memory leak in ah6.c Patrick McHardy
2004-05-29 19:37 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).