[ovs-dev] ovsdb-idl: Fix memory leak of idl->remote.
diff mbox series

Message ID 1551836796-65594-1-git-send-email-hzhou8@ebay.com
State New
Headers show
Series
  • [ovs-dev] ovsdb-idl: Fix memory leak of idl->remote.
Related show

Commit Message

Han Zhou March 6, 2019, 1:46 a.m. UTC
From: Han Zhou <hzhou8@ebay.com>

Reported by Address Sanitizer.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
---
 lib/ovsdb-idl.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Marchand March 6, 2019, 8:21 a.m. UTC | #1
Hello,

On Wed, Mar 6, 2019 at 4:23 AM Han Zhou <zhouhan@gmail.com> wrote:

> From: Han Zhou <hzhou8@ebay.com>
>
> Reported by Address Sanitizer.
>
> Signed-off-by: Han Zhou <hzhou8@ebay.com>
>

I think this fixes:

Fixes: 5e07b8f93f03 ("ovsdb-idl: New function
ovsdb_idl_create_unconnected().")

---
>  lib/ovsdb-idl.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> index 8cfb201..554bf76 100644
> --- a/lib/ovsdb-idl.c
> +++ b/lib/ovsdb-idl.c
> @@ -571,6 +571,9 @@ ovsdb_idl_destroy(struct ovsdb_idl *idl)
>          ovsdb_idl_db_destroy(&idl->server);
>          ovsdb_idl_db_destroy(&idl->data);
>          json_destroy(idl->request_id);
> +        if (idl->remote) {
> +            free(idl->remote);
> +        }
>

Testing for null is unnecessary.

         free(idl);
>      }
>  }
>

Patch
diff mbox series

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 8cfb201..554bf76 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -571,6 +571,9 @@  ovsdb_idl_destroy(struct ovsdb_idl *idl)
         ovsdb_idl_db_destroy(&idl->server);
         ovsdb_idl_db_destroy(&idl->data);
         json_destroy(idl->request_id);
+        if (idl->remote) {
+            free(idl->remote);
+        }
         free(idl);
     }
 }