diff options
author | Thomas Haller <thaller@redhat.com> | 2016-06-25 15:33:31 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-06-25 15:34:48 (GMT) |
commit | 49f612f1883e1a525229cce37f9380ae52ef8ad2 (patch) | |
tree | 1bdeb294c3fc6888ae134afdabc046022fc630c9 | |
parent | 6db1547c0d51b4cdd6c1601484788a758181bd54 (diff) | |
download | libnl-49f612f1883e1a525229cce37f9380ae52ef8ad2.zip libnl-49f612f1883e1a525229cce37f9380ae52ef8ad2.tar.gz libnl-49f612f1883e1a525229cce37f9380ae52ef8ad2.tar.bz2 |
xfrm: fix memleak in build_xfrm_sa_message() error-path
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | lib/xfrm/sa.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c index 4995207..a1abfe7 100644 --- a/lib/xfrm/sa.c +++ b/lib/xfrm/sa.c @@ -1167,8 +1167,10 @@ static int build_xfrm_sa_message(struct xfrmnl_sa *tmpl, int cmd, int flags, str len = sizeof (struct xfrm_algo) + ((tmpl->auth->alg_key_len + 7) / 8); auth = malloc(len); - if (!auth) + if (!auth) { + nlmsg_free(msg); return -NLE_NOMEM; + } strncpy(auth->alg_name, tmpl->auth->alg_name, sizeof(auth->alg_name)); auth->alg_key_len = tmpl->auth->alg_key_len; |