Skip to content

Commit

Permalink
controller: Free the qos hmap built in binding_run().
Browse files Browse the repository at this point in the history
Fixes the memory leak because of this.

Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
numansiddique committed May 15, 2020
1 parent d2a3f9a commit 83c14d2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion controller/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 83c14d2

Please sign in to comment.