From patchwork Fri Sep 14 21:43:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Pettit X-Patchwork-Id: 970122 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) 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 42Bpv53lrmz9s4V for ; Sat, 15 Sep 2018 07:44:17 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DE0C2C83; Fri, 14 Sep 2018 21:44:15 +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 DEEED707 for ; Fri, 14 Sep 2018 21:44:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 33082784 for ; Fri, 14 Sep 2018 21:44:13 +0000 (UTC) X-Originating-IP: 66.170.99.2 Received: from sc9-mailhost2.vmware.com (unknown [66.170.99.2]) (Authenticated sender: jpettit@ovn.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 144F21BF205 for ; Fri, 14 Sep 2018 21:44:11 +0000 (UTC) From: Justin Pettit To: dev@openvswitch.org Date: Fri, 14 Sep 2018 14:43:29 -0700 Message-Id: <20180914214329.8494-1-jpettit@ovn.org> X-Mailer: git-send-email 2.17.1 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 Subject: [ovs-dev] [PATCH] ofp-port: Don't leak on error in ofputil_pull_ofp14_port_stats(). 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 With this change, we can remove a case of free done in the error code path. Signed-off-by: Justin Pettit Reviewed-by: Yifeng Sun --- lib/ofp-port.c | 1 + lib/ofp-print.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ofp-port.c b/lib/ofp-port.c index ec70f46e96bb..3d1ada9ceb99 100644 --- a/lib/ofp-port.c +++ b/lib/ofp-port.c @@ -1697,6 +1697,7 @@ ofputil_pull_ofp14_port_stats(struct ofputil_port_stats *ops, } if (error) { + netdev_free_custom_stats_counters(&ops->custom_stats); return error; } } diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 37d7b8b98c55..e05a969a82b0 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -558,7 +558,6 @@ ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh, retval = ofputil_decode_port_stats(&ps, &b); if (retval) { - netdev_free_custom_stats_counters(&ps.custom_stats); return retval != EOF ? retval : 0; } ofputil_format_port_stats(string, &ps, port_map);