Message ID | 20200515101737.771233-1-numans@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,ovn] controller: Free the qos hmap built in binding_run(). | expand |
On 5/15/20 12:17 PM, numans@ovn.org wrote: > From: Numan Siddique <numans@ovn.org> > > Fixes the memory leak because of this. > > Signed-off-by: Numan Siddique <numans@ovn.org> Looks good to me. Acked-by: Dumitru Ceara <dceara@redhat.com> Thanks, Dumitru > --- > controller/binding.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/controller/binding.c b/controller/binding.c > index 9d37a23cc..a5525a310 100644 > --- a/controller/binding.c > +++ b/controller/binding.c > @@ -390,6 +390,17 @@ setup_qos(const char *egress_iface, struct hmap *queue_map) > netdev_close(netdev_phy); > } > > +static void > +destroy_qos_map(struct hmap *qos_map) > +{ > + struct qos_queue *qos_queue; > + HMAP_FOR_EACH_POP (qos_queue, node, qos_map) { > + free(qos_queue); > + } > + > + hmap_destroy(qos_map); > +} > + > static void > update_local_lport_ids(struct sset *local_lport_ids, > const struct sbrec_port_binding *binding_rec) > @@ -792,7 +803,7 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) > > shash_destroy(&lport_to_iface); > sset_destroy(&egress_ifaces); > - hmap_destroy(&qos_map); > + destroy_qos_map(&qos_map); > } > > /* Returns true if port-binding changes potentially require flow changes on >
On Fri, May 15, 2020 at 5:22 PM Dumitru Ceara <dceara@redhat.com> wrote: > On 5/15/20 12:17 PM, numans@ovn.org wrote: > > From: Numan Siddique <numans@ovn.org> > > > > Fixes the memory leak because of this. > > > > Signed-off-by: Numan Siddique <numans@ovn.org> > > Looks good to me. > > Acked-by: Dumitru Ceara <dceara@redhat.com> > Thanks Dumitru. I applied this patch to master and branch-20.03. Thanks Numan > > Thanks, > Dumitru > > > --- > > controller/binding.c | 13 ++++++++++++- > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > diff --git a/controller/binding.c b/controller/binding.c > > index 9d37a23cc..a5525a310 100644 > > --- a/controller/binding.c > > +++ b/controller/binding.c > > @@ -390,6 +390,17 @@ setup_qos(const char *egress_iface, struct hmap > *queue_map) > > netdev_close(netdev_phy); > > } > > > > +static void > > +destroy_qos_map(struct hmap *qos_map) > > +{ > > + struct qos_queue *qos_queue; > > + HMAP_FOR_EACH_POP (qos_queue, node, qos_map) { > > + free(qos_queue); > > + } > > + > > + hmap_destroy(qos_map); > > +} > > + > > static void > > update_local_lport_ids(struct sset *local_lport_ids, > > const struct sbrec_port_binding *binding_rec) > > @@ -792,7 +803,7 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct > binding_ctx_out *b_ctx_out) > > > > shash_destroy(&lport_to_iface); > > sset_destroy(&egress_ifaces); > > - hmap_destroy(&qos_map); > > + destroy_qos_map(&qos_map); > > } > > > > /* Returns true if port-binding changes potentially require flow > changes on > > > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > >
diff --git a/controller/binding.c b/controller/binding.c index 9d37a23cc..a5525a310 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -390,6 +390,17 @@ setup_qos(const char *egress_iface, struct hmap *queue_map) netdev_close(netdev_phy); } +static void +destroy_qos_map(struct hmap *qos_map) +{ + struct qos_queue *qos_queue; + HMAP_FOR_EACH_POP (qos_queue, node, qos_map) { + free(qos_queue); + } + + hmap_destroy(qos_map); +} + static void update_local_lport_ids(struct sset *local_lport_ids, const struct sbrec_port_binding *binding_rec) @@ -792,7 +803,7 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) shash_destroy(&lport_to_iface); sset_destroy(&egress_ifaces); - hmap_destroy(&qos_map); + destroy_qos_map(&qos_map); } /* Returns true if port-binding changes potentially require flow changes on