From patchwork Tue Nov 10 21:50:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 542629 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id CB44D140D69 for ; Wed, 11 Nov 2015 08:51:11 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id CAD3A10883; Tue, 10 Nov 2015 13:51:10 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 8B25410876 for ; Tue, 10 Nov 2015 13:51:09 -0800 (PST) Received: from bar2.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id E615942005D for ; Tue, 10 Nov 2015 14:51:08 -0700 (MST) X-ASG-Debug-ID: 1447192268-03dc530880245600001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar2.cudamail.com with ESMTP id IjYlucvJ1CKhCSxj (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 10 Nov 2015 14:51:08 -0700 (MST) X-Barracuda-Envelope-From: blp@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO relay3-d.mail.gandi.net) (217.70.183.195) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 10 Nov 2015 21:51:08 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at ovn.org designates 217.70.183.195 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.195 X-Barracuda-RBL-IP: 217.70.183.195 Received: from mfilter18-d.gandi.net (mfilter18-d.gandi.net [217.70.178.146]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id A6D67A80B4; Tue, 10 Nov 2015 22:51:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter18-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter18-d.gandi.net (mfilter18-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id eGeUoj5tvxLr; Tue, 10 Nov 2015 22:51:05 +0100 (CET) X-Originating-IP: 208.91.2.4 Received: from sigabrt.benpfaff.org (unknown [208.91.2.4]) (Authenticated sender: blp@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 90479A80B6; Tue, 10 Nov 2015 22:51:03 +0100 (CET) X-CudaMail-Envelope-Sender: blp@ovn.org From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-MID: CM-E2-1109087251 X-CudaMail-DTE: 111015 X-CudaMail-Originating-IP: 217.70.183.195 Date: Tue, 10 Nov 2015 13:50:58 -0800 X-ASG-Orig-Subj: [##CM-E2-1109087251##][PATCH] ovs-thread: Fix memory leak in thread exit. Message-Id: <1447192258-2214-1-git-send-email-blp@ovn.org> X-Mailer: git-send-email 2.1.3 X-GBUdb-Analysis: 0, 217.70.183.195, Ugly c=0.313739 p=-0.238095 Source Normal X-MessageSniffer-Rules: 0-0-0-2263-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1447192268 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.24283 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH] ovs-thread: Fix memory leak in thread exit. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff (blp at ovn.org) Acked-by: Jarno Rajahalme diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index 88b92d1..2f6bc58 100644 --- a/lib/ovs-thread.c +++ b/lib/ovs-thread.c @@ -665,7 +665,7 @@ ovsthread_key_destruct__(void *slots_) n = n_keys; ovs_mutex_unlock(&key_mutex); - for (i = 0; i < n / L2_SIZE; i++) { + for (i = 0; i < DIV_ROUND_UP(n, L2_SIZE); i++) { free(slots->p1[i]); } free(slots);