Skip to contentSkip to conversation

: Fix memory leak in ah6.c

PATCH Applied Patrick McHardy 2 participants 2 messages May 28, 2004 – May 29, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Fix memory leak in ah6.c

Hi Dave,

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

Regards
Patrick

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/05/28 12:21:37+02:00 [email protected]
# [IPSEC]: Fix memory leak in ah6.c
#

# net/ipv6/ah6.c
#   2004/05/28 12:21:29+02:00 [email protected] +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:

#1 lore raw
Quoted 2 lines · On Fri, 28 May 2004 12:50:29 +0200 Patrick McHardy <[email protected]> wrote:

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

Applied.