From patchwork Tue Jan 22 16:38:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Domke X-Patchwork-Id: 2019211 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1CD8DDFB7A for ; Tue, 22 Jan 2013 16:44:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754818Ab3AVQob (ORCPT ); Tue, 22 Jan 2013 11:44:31 -0500 Received: from mail02.nap.gsic.titech.ac.jp ([131.112.13.21]:58852 "HELO mail02.nap.gsic.titech.ac.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754728Ab3AVQo0 (ORCPT ); Tue, 22 Jan 2013 11:44:26 -0500 Received: from 131.112.13.37 by mail02.nap.gsic.titech.ac.jp with Mail2000 ESMTP Server V6.00S(11250:0:AUTH_RELAY) (envelope-from ); Wed, 23 Jan 2013 01:38:41 +0900 (JST) Received: from [131.112.13.22] (mail03.nap.gsic.titech.ac.jp) by drweb2.nap.gsic.titech.ac.jp (Dr.Web MailD 6.0.2.0) with SMTP id 01618BE7; Wed, 23 Jan 2013 01:38:41 Received: from 131.112.29.201 by mail03.nap.gsic.titech.ac.jp with Mail2000 ESMTP Server V6.00S(15874:0:AUTH_LOGIN) (envelope-from ); Wed, 23 Jan 2013 01:38:40 +0900 (JST) From: Jens Domke To: linux-rdma@vger.kernel.org Cc: Alex Netes , Torsten Hoefler , Jens Domke Subject: [PATCH 01/10] DFSSSP: fix a memory leak in dfsssp_build_graph Date: Wed, 23 Jan 2013 01:38:18 +0900 Message-Id: <1358872698-16850-1-git-send-email-domke.j.aa@m.titech.ac.jp> X-Mailer: git-send-email 1.7.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org If the graph could not be build correctly and DFSSSP returns an error, then not all allocated memory was freed. Signed-off-by: Jens Domke --- opensm/osm_ucast_dfsssp.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opensm/osm_ucast_dfsssp.c b/opensm/osm_ucast_dfsssp.c index ffc317f..ff525ea 100644 --- a/opensm/osm_ucast_dfsssp.c +++ b/opensm/osm_ucast_dfsssp.c @@ -1093,6 +1093,9 @@ static int dfsssp_build_graph(void *context) for (i = 0; i < adj_list_size; i++) set_default_vertex(&adj_list[i]); + dfsssp_ctx->adj_list = adj_list; + dfsssp_ctx->adj_list_size = adj_list_size; + /* count the total number of Hca / LIDs (for lmc>0) in the fabric */ for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl); item = cl_qmap_next(item)) { @@ -1190,9 +1193,6 @@ static int dfsssp_build_graph(void *context) if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG)) dfsssp_print_graph(p_mgr, adj_list, adj_list_size); - dfsssp_ctx->adj_list = adj_list; - dfsssp_ctx->adj_list_size = adj_list_size; - OSM_LOG_EXIT(p_mgr->p_log); return 0; }