From patchwork Tue Jan 22 16:39:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Domke X-Patchwork-Id: 2019431 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 94FB03FD1A for ; Tue, 22 Jan 2013 16:47:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754875Ab3AVQrz (ORCPT ); Tue, 22 Jan 2013 11:47:55 -0500 Received: from mail03.nap.gsic.titech.ac.jp ([131.112.13.22]:58649 "HELO mail03.nap.gsic.titech.ac.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754763Ab3AVQrx (ORCPT ); Tue, 22 Jan 2013 11:47:53 -0500 Received: from 131.112.13.36 by mail03.nap.gsic.titech.ac.jp with Mail2000 ESMTP Server V6.00S(15882:0:AUTH_RELAY) (envelope-from ); Wed, 23 Jan 2013 01:39:28 +0900 (JST) Received: from [131.112.13.20] (mail01.nap.gsic.titech.ac.jp) by drweb1.nap.gsic.titech.ac.jp (Dr.Web MailD 6.0.2.0) with SMTP id 0167C499; Wed, 23 Jan 2013 01:39:28 Received: from 131.112.29.201 by mail01.nap.gsic.titech.ac.jp with Mail2000 ESMTP Server V6.00S(806:0:AUTH_LOGIN) (envelope-from ); Wed, 23 Jan 2013 01:39:26 +0900 (JST) From: Jens Domke To: linux-rdma@vger.kernel.org Cc: Alex Netes , Torsten Hoefler , Dan Ben Yosef , Jens Domke Subject: [PATCH 02/10] opensm/osm_ucast_dfsssp.c : Fix resource leak Date: Wed, 23 Jan 2013 01:39:13 +0900 Message-Id: <1358872753-16885-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 From: Dan Ben Yosef Variable "head" going out of scope leaks the storage it points to. Signed-off-by: Dan Ben Yosef Signed-off-by: Jens Domke --- opensm/osm_ucast_dfsssp.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/opensm/osm_ucast_dfsssp.c b/opensm/osm_ucast_dfsssp.c index ff525ea..013bad4 100644 --- a/opensm/osm_ucast_dfsssp.c +++ b/opensm/osm_ucast_dfsssp.c @@ -1161,6 +1161,11 @@ static int dfsssp_build_graph(void *context) OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR AD08: cannot allocate memory for a link\n"); dfsssp_context_destroy(context); + while (head) { + link = head; + head = head->next; + free(link); + } return 1; } link = link->next;