From patchwork Sat May 20 10:33:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyunjian X-Patchwork-Id: 764951 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 3wVLr63sxyz9sN1 for ; Sat, 20 May 2017 20:33:58 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9B584898; Sat, 20 May 2017 10:33:56 +0000 (UTC) X-Original-To: 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 85BE32C for ; Sat, 20 May 2017 10:33:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 899A912A for ; Sat, 20 May 2017 10:33:54 +0000 (UTC) Received: from 172.30.72.56 (EHLO dggeml405-hub.china.huawei.com) ([172.30.72.56]) by dggrg03-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ANZ63839; Sat, 20 May 2017 18:33:50 +0800 (CST) Received: from localhost (10.177.24.66) by dggeml405-hub.china.huawei.com (10.3.17.49) with Microsoft SMTP Server id 14.3.301.0; Sat, 20 May 2017 18:33:41 +0800 From: Yunjian Wang To: Date: Sat, 20 May 2017 18:33:03 +0800 Message-ID: <1495276383-6012-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.24.66] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.59201B8E.0127, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c14a3cd35e9e2f36b62eb9bfe3584787 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] netflow: Fix memory leak in netflow_unref. 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 The memory leak was triggered each time on calling netflow_unref with containing netflow_flows. Signed-off-by: Yunjian Wang --- ofproto/netflow.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ofproto/netflow.c b/ofproto/netflow.c index 55f7814..6bcbfe5 100644 --- a/ofproto/netflow.c +++ b/ofproto/netflow.c @@ -413,6 +413,7 @@ netflow_unref(struct netflow *nf) atomic_count_dec(&netflow_count); collectors_destroy(nf->collectors); ofpbuf_uninit(&nf->packet); + hmap_destroy(&nf->flows); free(nf); } }