From patchwork Tue Sep 7 15:11:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 161201 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o87FBGgq001855 for ; Tue, 7 Sep 2010 15:12:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757017Ab0IGPL7 (ORCPT ); Tue, 7 Sep 2010 11:11:59 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:58299 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756198Ab0IGPL7 (ORCPT ); Tue, 7 Sep 2010 11:11:59 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from kliteyn@mellanox.co.il) with SMTP; 7 Sep 2010 18:11:17 +0300 Received: from [10.4.1.29] (10.4.1.29) by mtlmail01.mtl.com (10.0.8.12) with Microsoft SMTP Server id 8.2.254.0; Tue, 7 Sep 2010 18:11:55 +0300 Message-ID: <4C86563B.4070007@mellanox.co.il> Date: Tue, 7 Sep 2010 18:11:55 +0300 From: Yevgeny Kliteynik Reply-To: kliteyn@dev.mellanox.co.il User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sasha Khapyorsky , Linux RDMA Subject: [PATCH] opensm/osm_ucast_ftree.c: fixing another memory leak at error path 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 (demeter1.kernel.org [140.211.167.41]); Tue, 07 Sep 2010 15:12:00 +0000 (UTC) diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c index fb46d0f..d161bc8 100644 --- a/opensm/opensm/osm_ucast_ftree.c +++ b/opensm/opensm/osm_ucast_ftree.c @@ -1670,13 +1670,13 @@ static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree) &(all_switches_at_leaf_level[first_leaf_idx]), p_ftree->leaf_switches_num * sizeof(ftree_sw_t *)); - free(all_switches_at_leaf_level); - OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG, "Created array of %u leaf switches\n", p_ftree->leaf_switches_num); Exit: + if (all_switches_at_leaf_level) + free(all_switches_at_leaf_level); OSM_LOG_EXIT(&p_ftree->p_osm->log); return res; } /* fabric_create_leaf_switch_array() */