Free the error string returned by str_to_u8() in set_tunnel_config().
While at it, also add a proper error message for this error case.

Fixes: ebe0e518b048 ("tunnel: Bareudp Tunnel Support.")
Signed-off-by: Eelco Chaudron <[email protected]>
---
 lib/netdev-vport.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index ed67b509d..d11269d00 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -813,9 +813,13 @@ set_tunnel_config(struct netdev *dev_, const struct smap 
*args, char **errp)
                  tnl_cfg.exts |= (1 << OVS_BAREUDP_EXT_MULTIPROTO_MODE);
             } else {
                  uint16_t payload_ethertype;
+                 char *error = str_to_u16(node->value, "payload_type",
+                                          &payload_ethertype);
 
-                 if (str_to_u16(node->value, "payload_type",
-                                &payload_ethertype)) {
+                 if (error) {
+                     free(error);
+                     ds_put_format(&errors, "%s: bad %s 'payload_type'\n",
+                                   name, node->value);
                      err = EINVAL;
                      goto out;
                  }
-- 
2.50.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to