[PATCH 2/3] xfrm: Fix memory leak for encap original address
Thomas Egerer
thomas.egerer at secunet.com
Fri Jun 10 02:57:55 PDT 2016
Signed-off-by: Thomas Egerer <thomas.egerer at secunet.com>
---
lib/xfrm/sa.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c
index b330409..b1ef00e 100644
--- a/lib/xfrm/sa.c
+++ b/lib/xfrm/sa.c
@@ -110,8 +110,11 @@ static void xfrm_sa_free_data(struct nl_object *c)
free (sa->crypt);
if (sa->comp)
free (sa->comp);
- if (sa->encap)
- free (sa->encap);
+ if (sa->encap) {
+ if (sa->encap->encap_oa)
+ nl_addr_put(sa->encap->encap_oa);
+ free(sa->encap);
+ }
if (sa->coaddr)
nl_addr_put (sa->coaddr);
if (sa->sec_ctx)
--
2.1.3
More information about the libnl
mailing list