diff mbox

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

Message ID 1445554650-21984-1-git-send-email-jpettit@nicira.com
State Accepted
Headers show

Commit Message

Justin Pettit Oct. 22, 2015, 10:57 p.m. UTC
Signed-off-by: Justin Pettit <jpettit@nicira.com>
---
 lib/tnl-ports.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Andy Zhou Oct. 22, 2015, 11:47 p.m. UTC | #1
Acked-by: Andy Zhou <azhou@nicira.com>

On Thu, Oct 22, 2015 at 3:57 PM, Justin Pettit <jpettit@nicira.com> wrote:
> Signed-off-by: Justin Pettit <jpettit@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
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
Andy Zhou Oct. 23, 2015, 12:53 a.m. UTC | #2
Thanks for killing all those memory leak bugs!

Acked-by: Andy Zhou <azhou@nicira.com>



On Thu, Oct 22, 2015 at 3:57 PM, Justin Pettit <jpettit@nicira.com> wrote:
> Signed-off-by: Justin Pettit <jpettit@nicira.com>
> ---
>  ovn/utilities/ovn-nbctl.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
> index 947c58c..2303f31 100644
> --- a/ovn/utilities/ovn-nbctl.c
> +++ b/ovn/utilities/ovn-nbctl.c
> @@ -268,6 +268,7 @@ parse_options(int argc, char *argv[], struct shash *local_options)
>              abort();
>          }
>      }
> +    free(short_options);
>
>      if (!db) {
>          db = nbctl_default_db();
> --
> 1.7.5.4
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
Justin Pettit Oct. 23, 2015, 12:59 a.m. UTC | #3
> On Oct 22, 2015, at 5:53 PM, Andy Zhou <azhou@nicira.com> wrote:
> 
> Thanks for killing all those memory leak bugs!
> 
> Acked-by: Andy Zhou <azhou@nicira.com>

Thanks for the reviews!  I'll figure out which ones I should backport to older releases.

--Justin
diff mbox

Patch

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);