diff options
author | Peter Wu <peter@lekensteyn.nl> | 2016-08-08 11:58:51 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-08-14 09:57:25 +0200 |
commit | f1029d44be079f3fe82ec6bb03993d454990f84b (patch) | |
tree | a604bdb94b46901de409550d195908c3eaf17292 /lib/xfrm/sa.c | |
parent | f6b7a7f974c3eaadc9d4705d61780de6a7009854 (diff) | |
download | libnl-f1029d44be079f3fe82ec6bb03993d454990f84b.tar.gz |
xfrm: fix memleak in another error path of build_xfrm_sa_message
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'lib/xfrm/sa.c')
-rw-r--r-- | lib/xfrm/sa.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c index 74b7ee98..9e2c353c 100644 --- a/lib/xfrm/sa.c +++ b/lib/xfrm/sa.c @@ -1175,7 +1175,10 @@ static int build_xfrm_sa_message(struct xfrmnl_sa *tmpl, int cmd, int flags, str strncpy(auth->alg_name, tmpl->auth->alg_name, sizeof(auth->alg_name)); auth->alg_key_len = tmpl->auth->alg_key_len; memcpy(auth->alg_key, tmpl->auth->alg_key, (tmpl->auth->alg_key_len + 7) / 8); - NLA_PUT(msg, XFRMA_ALG_AUTH, len, auth); + if (nla_put(msg, XFRMA_ALG_AUTH, len, auth) < 0) { + free(auth); + goto nla_put_failure; + } free(auth); } } |