From: Hans Dedecker Date: Thu, 12 Apr 2018 20:14:52 +0000 (+0200) Subject: system-linux: fix memory leak on error in system_add_vxlan() X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=commitdiff_plain;h=1e2cf67ef36eaaed9a7f18898066df5c2366fd0d system-linux: fix memory leak on error in system_add_vxlan() Detected by coverity in CID 1412449 Signed-off-by: Hans Dedecker --- 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);