[ovs-dev] [PATCH 1/6] tnl-ports: Free "ip_dev" on error.

Justin Pettit jpettit at nicira.com
Thu Oct 22 22:57:25 UTC 2015


Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 lib/tnl-ports.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c
index c82f018..77cf5bb 100644
--- a/lib/tnl-ports.c
+++ b/lib/tnl-ports.c
@@ -364,11 +364,13 @@ insert_ipdev(const char dev_name[])
     ip_dev->change_seq = netdev_get_change_seq(dev);
     error = netdev_get_etheraddr(ip_dev->dev, &ip_dev->mac);
     if (error) {
+        free(ip_dev);
         return;
     }
     error4 = netdev_get_in4(ip_dev->dev, (struct in_addr *)&ip_dev->addr4, NULL);
     error6 = netdev_get_in6(ip_dev->dev, &ip_dev->addr6);
     if (error4 && error6) {
+        free(ip_dev);
         return;
     }
     ovs_strlcpy(ip_dev->dev_name, netdev_get_name(dev), sizeof ip_dev->dev_name);
-- 
1.7.5.4




More information about the dev mailing list