system-linux: fix memory leak on error in system_add_vxlan()
authorHans Dedecker <dedeckeh@gmail.com>
Thu, 12 Apr 2018 20:14:52 +0000 (22:14 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Thu, 12 Apr 2018 20:16:50 +0000 (22:16 +0200)
Detected by coverity in CID 1412449

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
system-linux.c

index 0ca525602d9ea63ac5b845b2be9c6c7bdec7c26c..6fb0a01bf20c9b117c729fa3a04c20b8f9cc2fef 100644 (file)
@@ -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);