diff mbox series

[ovs-dev,branch-2.12] lflow.c: Fix memory leak of lflow_ref_list_node->ref_name.

Message ID 1572501072-67766-1-git-send-email-hzhou@ovn.org
State Accepted
Commit e4c825d1826d8de5dfec9534b18421de4e46b300
Headers show
Series [ovs-dev,branch-2.12] lflow.c: Fix memory leak of lflow_ref_list_node->ref_name. | expand

Commit Message

Han Zhou Oct. 31, 2019, 5:51 a.m. UTC
The ref_name is copied in lflow_resource_add(), but forgot to free in
lflow_resource_destroy_lflow(). It can be fixed by freeing it in
lflow_resource_destroy_lflow(). However, this field is never really
used, so just delete it from lflow_ref_list_node, together with the
"type" field.

Fixes: 43e6900a7991 ("ovn-controller: Maintain resource references for logical flows.")
Acked-by: Numan Siddique <numans@ovn.org>
Signed-off-by: Han Zhou <hzhou@ovn.org>
---
Note: This patch has been merged to ovn repo. This is backport to branch-2.12.

 ovn/controller/lflow.c | 2 --
 ovn/controller/lflow.h | 2 --
 2 files changed, 4 deletions(-)

Comments

Ben Pfaff Oct. 31, 2019, 4:36 p.m. UTC | #1
On Wed, Oct 30, 2019 at 10:51:12PM -0700, Han Zhou wrote:
> The ref_name is copied in lflow_resource_add(), but forgot to free in
> lflow_resource_destroy_lflow(). It can be fixed by freeing it in
> lflow_resource_destroy_lflow(). However, this field is never really
> used, so just delete it from lflow_ref_list_node, together with the
> "type" field.
> 
> Fixes: 43e6900a7991 ("ovn-controller: Maintain resource references for logical flows.")
> Acked-by: Numan Siddique <numans@ovn.org>
> Signed-off-by: Han Zhou <hzhou@ovn.org>
> ---
> Note: This patch has been merged to ovn repo. This is backport to branch-2.12.

Thanks, applied to branch-2.12.
diff mbox series

Patch

diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c
index 1aafafb..dd72a5b 100644
--- a/ovn/controller/lflow.c
+++ b/ovn/controller/lflow.c
@@ -230,8 +230,6 @@  lflow_resource_add(struct lflow_resource_ref *lfrr, enum ref_type type,
     }
 
     struct lflow_ref_list_node *lrln = xzalloc(sizeof *lrln);
-    lrln->type = type;
-    lrln->ref_name = xstrdup(ref_name);
     lrln->lflow_uuid = *lflow_uuid;
     ovs_list_push_back(&rlfn->ref_lflow_head, &lrln->ref_list);
     ovs_list_push_back(&lfrn->lflow_ref_head, &lrln->lflow_list);
diff --git a/ovn/controller/lflow.h b/ovn/controller/lflow.h
index 4e1086e..752bd59 100644
--- a/ovn/controller/lflow.h
+++ b/ovn/controller/lflow.h
@@ -79,8 +79,6 @@  enum ref_type {
 struct lflow_ref_list_node {
     struct ovs_list lflow_list; /* list for same lflow */
     struct ovs_list ref_list; /* list for same ref */
-    enum ref_type type;
-    char *ref_name;
     struct uuid lflow_uuid;
 };