From patchwork Fri May 15 10:17:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1291005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49NkrL0kZHz9sTM for ; Fri, 15 May 2020 20:18:10 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B8A2588DC0; Fri, 15 May 2020 10:18:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vsy5HE344DFG; Fri, 15 May 2020 10:18:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 50BAD88C3A; Fri, 15 May 2020 10:18:03 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2866DC0178; Fri, 15 May 2020 10:18:03 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8C9A1C016F for ; Fri, 15 May 2020 10:18:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6A214267D6 for ; Fri, 15 May 2020 10:18:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Jpid6zUwKhJ for ; Fri, 15 May 2020 10:17:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by silver.osuosl.org (Postfix) with ESMTPS id D89902305A for ; Fri, 15 May 2020 10:17:56 +0000 (UTC) X-Originating-IP: 125.99.246.58 Received: from nusiddiq.home.org.com (unknown [125.99.246.58]) (Authenticated sender: numans@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id EBC07E000D; Fri, 15 May 2020 10:17:52 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Fri, 15 May 2020 15:47:37 +0530 Message-Id: <20200515101737.771233-1-numans@ovn.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn] controller: Free the qos hmap built in binding_run(). X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Numan Siddique Fixes the memory leak because of this. Signed-off-by: Numan Siddique Acked-by: Dumitru Ceara --- 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