summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Egerer <thomas.egerer@secunet.com>2016-06-10 09:57:55 (GMT)
committerThomas Haller <thaller@redhat.com>2016-06-25 15:31:38 (GMT)
commit01bd6ef7e048f23564587865ad0d2e7103bd384b (patch)
treedfae1797cb30759dc97413afc4598b8fa23c979f
parent0ee916bf6bb61e98917081fb6d8273250b34b7cc (diff)
downloadlibnl-01bd6ef7e048f23564587865ad0d2e7103bd384b.zip
libnl-01bd6ef7e048f23564587865ad0d2e7103bd384b.tar.gz
libnl-01bd6ef7e048f23564587865ad0d2e7103bd384b.tar.bz2
xfrm: fix memory leak for encap original address
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com> Signed-off-by: Thomas Haller <thaller@redhat.com> http://lists.infradead.org/pipermail/libnl/2016-June/002141.html
-rw-r--r--lib/xfrm/sa.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c
index dc57913..999df3b 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)