From patchwork Tue Mar 5 23:27:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1052058 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="l0pscWOn"; dkim-atps=neutral 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 44DY3S3sRHz9sBp for ; Wed, 6 Mar 2019 10:28:03 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id BEDD71060F; Tue, 5 Mar 2019 23:27:10 +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 D566110606 for ; Tue, 5 Mar 2019 23:27:08 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 840097FF for ; Tue, 5 Mar 2019 23:27:08 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id i20so6891554pfo.6 for ; Tue, 05 Mar 2019 15:27:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=MSf0Z8JPuVEYcL29ngPUW3wOxjYEr0Uqz59uL0UF8aM=; b=l0pscWOn3T1Y1VXuNeFj9ofqKUVg5cZ8Npeh4NKkrXgUiSHsygjDOJ9d1y9yQhIALn 3Xiv0WTkw1ysx8eeJJwjI6xxkamILKeeuVf70LlVoxBRMOAimUhSLRrNSsT7Z6W9ELud E0mSwNnkxJsFkUPGITP/m/RaLfaEuoK4GNGhJtQ7zlIGwJoDq44UwjaC9DT7FEtnyIxV oFNrTvHIg6y0LXPzAHaWSkEx1o8QY4EQIsRVQuLnfjKazULkn8K9WZs+RiC5UsJQ0liR L1Nl1UXkKF09+E6OKFyGUdnQFaRMLN+IEDNIACWS6ygT5uHXuExXmeti8hJU05Cyal6V dAxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MSf0Z8JPuVEYcL29ngPUW3wOxjYEr0Uqz59uL0UF8aM=; b=n7cpX2qC/pnHDCTGRoaFWfvjQTwZD//e4xhO5r71V6DHyRnhWZlKap9ZrNLYFmXFHn LvnH24CmHJkB8DjMKhX+LH9rCYKTqx0yYt+1mx3Zno4MSs+z/cYiyoPM+0NdYSrfEeo4 fTWRtihpFYV/kF3Y93Ldv2F2OTb3VZJPAf8S6TSkqbAFHjqGDJ3mtyDqvY193t+3KN2Z LUN04NJ9fTcih7cuGynGDG3QXM4bmJAxjdMuC6XzaFBwam2jBHzEFVuzErW+TEN3zOlT X/VHtAgQgTz/pKacWK2+kDJgvO3D4i71k0NX8Q/x1kzHjMAAGzAtkLWGOTr9WZ3b0BG3 tDjg== X-Gm-Message-State: APjAAAU/2vS6riU9nkWCxhZOdI5QUDD/x9Q2D4KDkW6cwaGuxvMM6U98 49A6k/BXAZBa5qZq3SRHQsSQM4FH X-Google-Smtp-Source: APXvYqxn0rSZdT84nVoLXycg/qVb9al2mx+NqRZpfRzSxw7/UWF5huI/1hCekEYOH2xF4VhPQKsezw== X-Received: by 2002:a63:de48:: with SMTP id y8mr3617322pgi.253.1551828427570; Tue, 05 Mar 2019 15:27:07 -0800 (PST) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id j14sm132249pfn.77.2019.03.05.15.27.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Mar 2019 15:27:06 -0800 (PST) From: Yifeng Sun To: dev@openvswitch.org Date: Tue, 5 Mar 2019 15:27:01 -0800 Message-Id: <1551828421-1923-1-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE 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] dpif-netlink: Free leaked ofpbuf by using ofpbuf_delete 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 Found by valgrind. 256 bytes in 4 blocks are definitely lost in loss record 319 of 348 by 0x52E204: xmalloc (util.c:123) by 0x4F6172: ofpbuf_new (ofpbuf.c:151) by 0x53DEF2: dpif_netlink_ct_get_limits (dpif-netlink.c:2951) by 0x587881: dpctl_ct_get_limits (dpctl.c:1904) by 0x58566F: dpctl_unixctl_handler (dpctl.c:2589) by 0x52D660: process_command (unixctl.c:308) by 0x52D660: run_connection (unixctl.c:342) by 0x52D660: unixctl_server_run (unixctl.c:393) by 0x407366: main (ovs-vswitchd.c:126) Signed-off-by: Yifeng Sun --- lib/dpif-netlink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index 73641a5b5b5a..00538e5e47d9 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -2884,7 +2884,7 @@ dpif_netlink_ct_set_limits(struct dpif *dpif OVS_UNUSED, nl_msg_end_nested(request, opt_offset); int err = nl_transact(NETLINK_GENERIC, request, NULL); - ofpbuf_uninit(request); + ofpbuf_delete(request); return err; } @@ -2984,8 +2984,8 @@ dpif_netlink_ct_get_limits(struct dpif *dpif OVS_UNUSED, zone_limits_reply); out: - ofpbuf_uninit(request); - ofpbuf_uninit(reply); + ofpbuf_delete(request); + ofpbuf_delete(reply); return err; } @@ -3021,7 +3021,7 @@ dpif_netlink_ct_del_limits(struct dpif *dpif OVS_UNUSED, int err = nl_transact(NETLINK_GENERIC, request, NULL); - ofpbuf_uninit(request); + ofpbuf_delete(request); return err; }