From patchwork Sun Apr 25 14:06:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 94957 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3PE6AGQ027422 for ; Sun, 25 Apr 2010 14:06:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753591Ab0DYOGF (ORCPT ); Sun, 25 Apr 2010 10:06:05 -0400 Received: from mail-bw0-f219.google.com ([209.85.218.219]:63681 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752413Ab0DYOGE (ORCPT ); Sun, 25 Apr 2010 10:06:04 -0400 Received: by bwz19 with SMTP id 19so586470bwz.21 for ; Sun, 25 Apr 2010 07:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :subject:message-id:mime-version:content-type:content-disposition :user-agent; bh=/KDicM8ZEk/0cI3zbhKrZiZ4IrK7jUfYezX/CArG+rw=; b=pnCGZLxM/n+R41kvZijuK6MTUU9vPzd7fdSGVZnbgMXYJisf7iq5KJSSZ05NO+XZwv d47234SqEA8u6lDxZjF8vP8jJrxE/i0SHi/+r4yffpQKKkwbNm77G5+urioBwmFe/njd WOIoKRhmqV74povCMRBJHuAD7esJBk/+z6k1k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=C15DcjScd+hRoxR1NTtkRFiNLlS9EfoCgoLuJ7SkKiGyE3SN8KOO8xbpkAUlq9Egtg kAmNyh01tHB1iUMSk4wySVhyxYhvpO271MBTpl04/fdLyRfRbswoOSMRgX4ARjN10sQZ 4EOo2lSdUalKwZOXeXT1aImHHtomKCkhZan5A= Received: by 10.103.81.29 with SMTP id i29mr1442193mul.109.1272204360658; Sun, 25 Apr 2010 07:06:00 -0700 (PDT) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id e9sm12589648muf.10.2010.04.25.07.05.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 25 Apr 2010 07:05:59 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id DE73A11DF7; Sun, 25 Apr 2010 17:06:32 +0300 (IDT) Date: Sun, 25 Apr 2010 17:06:32 +0300 From: Sasha Khapyorsky To: linux-rdma Subject: [PATCH] opensm/osm_lid_mgr.c: fix memory leak Message-ID: <20100425140632.GP23994@me> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 25 Apr 2010 14:06:10 +0000 (UTC) diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c index f14d377..9896196 100644 --- a/opensm/opensm/osm_lid_mgr.c +++ b/opensm/opensm/osm_lid_mgr.c @@ -636,11 +636,12 @@ static void lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * p_mgr, /* but we can be out of the range */ if (lid + num_lids - 1 <= p_range->max_lid) { /* ok let us use that range */ - if (lid + num_lids - 1 == p_range->max_lid) + if (lid + num_lids - 1 == p_range->max_lid) { /* we consumed the entire range */ cl_qlist_remove_item(&p_mgr->free_ranges, p_item); - else + free(p_item); + } else /* only update the available range */ p_range->min_lid = lid + num_lids;