From patchwork Tue Oct 22 01:26:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1180957 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.169.12; helo=mail.linuxfoundation.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 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 46xwpZ0lLJz9sNx for ; Tue, 22 Oct 2019 12:27:01 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7EA8BC3E; Tue, 22 Oct 2019 01:26:58 +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 91D45C21 for ; Tue, 22 Oct 2019 01:26:57 +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 smtp1.linuxfoundation.org (Postfix) with ESMTPS id D3E63896 for ; Tue, 22 Oct 2019 01:26:56 +0000 (UTC) X-Originating-IP: 216.113.160.71 Received: from localhost.localdomain.localdomain (unknown [216.113.160.71]) (Authenticated sender: hzhou@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 2258040005; Tue, 22 Oct 2019 01:26:53 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Mon, 21 Oct 2019 18:26:44 -0700 Message-Id: <1571707604-48212-1-git-send-email-hzhou@ovn.org> X-Mailer: git-send-email 2.1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Han Zhou Subject: [ovs-dev] [PATCH ovn] lflow.c: Fix memory leak of lflow_ref_list_node->ref_name. 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The ref_name is copied in lflow_resource_add(), but forgot to free in lflow_resource_destroy_lflow(). It can be fixed by freeing it in lflow_resource_destroy_lflow(). However, this field is never really used, so just delete it from lflow_ref_list_node, together with the "type" field. Fixes: d2aa2c7cafead ("ovn-controller: Maintain resource references for logical flows.") Signed-off-by: Han Zhou Acked-by: Numan Siddique --- controller/lflow.c | 2 -- controller/lflow.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/controller/lflow.c b/controller/lflow.c index e3ed20c..24e3a52 100644 --- a/controller/lflow.c +++ b/controller/lflow.c @@ -230,8 +230,6 @@ lflow_resource_add(struct lflow_resource_ref *lfrr, enum ref_type type, } struct lflow_ref_list_node *lrln = xzalloc(sizeof *lrln); - lrln->type = type; - lrln->ref_name = xstrdup(ref_name); lrln->lflow_uuid = *lflow_uuid; ovs_list_push_back(&rlfn->ref_lflow_head, &lrln->ref_list); ovs_list_push_back(&lfrn->lflow_ref_head, &lrln->lflow_list); diff --git a/controller/lflow.h b/controller/lflow.h index 0572668..abdc55e 100644 --- a/controller/lflow.h +++ b/controller/lflow.h @@ -80,8 +80,6 @@ enum ref_type { struct lflow_ref_list_node { struct ovs_list lflow_list; /* list for same lflow */ struct ovs_list ref_list; /* list for same ref */ - enum ref_type type; - char *ref_name; struct uuid lflow_uuid; };