From patchwork Wed Jul 8 14:14:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1325232 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 4B21Wx2p5Bz9sRN for ; Thu, 9 Jul 2020 00:14:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1EB9887832; Wed, 8 Jul 2020 14:14:19 +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 Qogm2VaToo4S; Wed, 8 Jul 2020 14:14:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id C469E85784; Wed, 8 Jul 2020 14:14:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B0C33C077B; Wed, 8 Jul 2020 14:14:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 51E71C016F for ; Wed, 8 Jul 2020 14:14:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4762C86FCB for ; Wed, 8 Jul 2020 14:14:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t0gwhikL6pbj for ; Wed, 8 Jul 2020 14:14:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E9F9686F57 for ; Wed, 8 Jul 2020 14:14:14 +0000 (UTC) X-Originating-IP: 115.99.177.166 Received: from nusiddiq.home.org.com (unknown [115.99.177.166]) (Authenticated sender: numans@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 6154840004; Wed, 8 Jul 2020 14:14:09 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Wed, 8 Jul 2020 19:44:01 +0530 Message-Id: <20200708141401.21993-1-numans@ovn.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn] ovn-controller: Fix the memory leak in ref lflow handling. 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 Valgrind found this: tests/testsuite.dir/129/valgrind.415:12:==415== 4 bytes in 1 blocks are definitely lost in loss record 2 of 126 tests/testsuite.dir/129/valgrind.415-13-==415== at 0x4C29E63: malloc (vg_replace_malloc.c:309) tests/testsuite.dir/129/valgrind.415-14-==415== by 0x4CEC87: xmalloc (util.c:138) tests/testsuite.dir/129/valgrind.415-15-==415== by 0x4CECF4: xmemdup0 (util.c:168) tests/testsuite.dir/129/valgrind.415-16-==415== by 0x4118AF: lflow_resource_add (lflow.c:231) tests/testsuite.dir/129/valgrind.415-17-==415== by 0x412507: consider_logical_flow (lflow.c:670) tests/testsuite.dir/129/valgrind.415-18-==415== by 0x4148C2: add_logical_flows (lflow.c:303) tests/testsuite.dir/129/valgrind.415-19-==415== by 0x4148C2: lflow_run (lflow.c:858) tests/testsuite.dir/129/valgrind.415-20-==415== by 0x42A16C: en_flow_output_run (ovn-controller.c:1765) tests/testsuite.dir/129/valgrind.415-21-==415== by 0x43FFE0: engine_compute (inc-proc-eng.c:310) tests/testsuite.dir/129/valgrind.415-22-==415== by 0x43FFE0: engine_run_node (inc-proc-eng.c:352) tests/testsuite.dir/129/valgrind.415-23-==415== by 0x43FFE0: engine_run (inc-proc-eng.c:377) tests/testsuite.dir/129/valgrind.415-24-==415== by 0x40995E: main (ovn-controller.c:2425) ref_name member of 'struct ref_lflow_node' was not freed when handling the port binding/address set/port group changes in lflow.c This patch fixes this issue. Fixes: 8a2c19f26ffa("ovn-controller: Incremental processing for address-set changes.") Reported-by: Dumitru Ceara Signed-off-by: Numan Siddique Acked-by: Dumitru Ceara --- controller/lflow.c | 1 + 1 file changed, 1 insertion(+) diff --git a/controller/lflow.c b/controller/lflow.c index 545436159..b2f585727 100644 --- a/controller/lflow.c +++ b/controller/lflow.c @@ -476,6 +476,7 @@ lflow_handle_changed_ref(enum ref_type ref_type, const char *ref_name, ovs_list_remove(&lrln->ref_list); free(lrln); } + free(rlfn->ref_name); free(rlfn); dhcp_opts_destroy(&dhcp_opts);