From patchwork Wed Feb 8 07:33:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Zhou X-Patchwork-Id: 725518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vJCd65Sfjz9s7Z for ; Wed, 8 Feb 2017 18:34:02 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6540CC00; Wed, 8 Feb 2017 07:33:57 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id AA50BC0D for ; Wed, 8 Feb 2017 07:33:55 +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 smtp1.linuxfoundation.org (Postfix) with ESMTPS id 24A26178 for ; Wed, 8 Feb 2017 07:33:55 +0000 (UTC) Received: from mfilter31-d.gandi.net (mfilter31-d.gandi.net [217.70.178.162]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id E52491720C5 for ; Wed, 8 Feb 2017 08:33:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter31-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter31-d.gandi.net (mfilter31-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id vXmA-bGRy5_L for ; Wed, 8 Feb 2017 08:33:52 +0100 (CET) X-Originating-IP: 74.125.82.179 Received: from mail-ot0-f179.google.com (mail-ot0-f179.google.com [74.125.82.179]) (Authenticated sender: azhou@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 42F9B1720B3 for ; Wed, 8 Feb 2017 08:33:52 +0100 (CET) Received: by mail-ot0-f179.google.com with SMTP id 32so106710449oth.3 for ; Tue, 07 Feb 2017 23:33:52 -0800 (PST) X-Gm-Message-State: AMke39l9yprDzl3nfDrcHIxgpWWdg28yRFtub8/P4qUyUaPPZjjKYpPcIbW116MYoke4CCAzxzCWFcqiI8A1RA== X-Received: by 10.157.59.72 with SMTP id z66mr9202919otb.191.1486539230947; Tue, 07 Feb 2017 23:33:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.158.21 with HTTP; Tue, 7 Feb 2017 23:33:10 -0800 (PST) In-Reply-To: <1486536071-14280-1-git-send-email-u9012063@gmail.com> References: <1486536071-14280-1-git-send-email-u9012063@gmail.com> From: Andy Zhou Date: Tue, 7 Feb 2017 23:33:10 -0800 X-Gmail-Original-Message-ID: Message-ID: To: William Tu X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: ovs-dev Subject: Re: [ovs-dev] [PATCH 1/2] ovs-router: fix memory leak reported by valgrind. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org On Tue, Feb 7, 2017 at 10:41 PM, William Tu wrote: > Valgrind testcase 772: appctl - route/lookup6 reports the > following definitely lost: > xmalloc (util.c:112) > miniflow_alloc (flow.c:2500) > minimatch_init (match.c:1387) > rt_entry_delete (ovs-router.c:274) > ovs_router_del (ovs-router.c:384) > process_command (unixctl.c:313) > > Signed-off-by: William Tu > --- > lib/ovs-router.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/ovs-router.c b/lib/ovs-router.c > index d98de20..53fb834 100644 > --- a/lib/ovs-router.c > +++ b/lib/ovs-router.c > @@ -280,6 +280,7 @@ rt_entry_delete(uint32_t mark, uint8_t priority, > res = __rt_entry_delete(cr); > ovs_mutex_unlock(&mutex); > } > + minimatch_destroy(CONST_CAST(struct minimatch *, &rule.match)); > return res; > } > Acked-by: Andy Zhou , May be this can be easier to read? dev@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev diff --git a/lib/ovs-router.c b/lib/ovs-router.c index d98de20..794fdde 100644 --- a/lib/ovs-router.c +++ b/lib/ovs-router.c @@ -280,6 +280,9 @@ rt_entry_delete(uint32_t mark, uint8_t priority, res = __rt_entry_delete(cr); ovs_mutex_unlock(&mutex); } + + cls_rule_destroy(&rule); return res; } _______________________________________________ dev mailing list