On Tue, Aug 26, 2014 at 06:36:08PM +0200, Thomas Graf wrote:
> Signed-off-by: Thomas Graf <tg...@noironetworks.com>
> ---
>  lib/dpif-netdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 7401293..c7a1242 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -669,6 +669,8 @@ do_add_port(struct dp_netdev *dp, const char *devname, 
> const char *type,
>              VLOG_ERR("%s: cannot receive packets on this network device 
> (%s)",
>                       devname, ovs_strerror(errno));
>              netdev_close(netdev);
> +            free(port->rxq);
> +            free(port);
>              return error;
>          }
>      }
This still missed port->type so I redid it as follows and will push in
a minute after testing.

--8<--------------------------cut here-------------------------->8--

From: Thomas Graf <tg...@noironetworks.com>
Date: Tue, 26 Aug 2014 18:36:08 +0200
Subject: [PATCH] dpif-netdev: Fix leaked port, port->rxq, port->type in error
 path

Signed-off-by: Thomas Graf <tg...@noironetworks.com>
[b...@nicira.com added free of port->type]
Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/dpif-netdev.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 7401293..9e01931 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -669,6 +669,9 @@ do_add_port(struct dp_netdev *dp, const char *devname, 
const char *type,
             VLOG_ERR("%s: cannot receive packets on this network device (%s)",
                      devname, ovs_strerror(errno));
             netdev_close(netdev);
+            free(port->type);
+            free(port->rxq);
+            free(port);
             return error;
         }
     }
@@ -679,6 +682,7 @@ do_add_port(struct dp_netdev *dp, const char *devname, 
const char *type,
             netdev_rxq_close(port->rxq[i]);
         }
         netdev_close(netdev);
+        free(port->type);
         free(port->rxq);
         free(port);
         return error;
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to