From 1e2cf67ef36eaaed9a7f18898066df5c2366fd0d Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Thu, 12 Apr 2018 22:14:52 +0200 Subject: [PATCH] system-linux: fix memory leak on error in system_add_vxlan() Detected by coverity in CID 1412449 Signed-off-by: Hans Dedecker --- system-linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system-linux.c b/system-linux.c index 0ca5256..6fb0a01 100644 --- a/system-linux.c +++ b/system-linux.c @@ -2824,8 +2824,10 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl unsigned tos = 1; if (strcmp(str, "inherit")) { - if (!system_tos_aton(str, &tos)) - return -EINVAL; + if (!system_tos_aton(str, &tos)) { + ret = -EINVAL; + goto failure; + } } nla_put_u8(msg, IFLA_VXLAN_TOS, tos); -- 2.25.1