From patchwork Wed Feb 20 19:03:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2168841 X-Patchwork-Delegate: hal@mellanox.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 396813FD4E for ; Wed, 20 Feb 2013 19:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933725Ab3BTTDJ (ORCPT ); Wed, 20 Feb 2013 14:03:09 -0500 Received: from mail-ia0-f179.google.com ([209.85.210.179]:47485 "EHLO mail-ia0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933548Ab3BTTDI (ORCPT ); Wed, 20 Feb 2013 14:03:08 -0500 Received: by mail-ia0-f179.google.com with SMTP id x24so7514597iak.10 for ; Wed, 20 Feb 2013 11:03:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:content-type:content-transfer-encoding:x-gm-message-state; bh=63j0JzlhIbcXstslkIxYUE87GU0iwLLkX3dmbAFypJw=; b=C2ERQ2XOgMGuARgWpfbaQEdbpPe9QPrsTWrzobulWBLd2feNTlkQ1GGBlK52AfuxGz dNl8/s6rt9Zvms6FLWeXJy+Gptrh9fvfgVW1T+ct4mIA88tmrZIL7zzGx5Et6ECV5D6B eBqR9c9Cp9GiQFjSnKxUm5oW5bDKITHYmF54nVtT3WoEWohoMi/jbTxqg6XBnzctNb4w X5IBjfRvbXXDWgPZjRoTtj1JUiNY2sC3ZW+Cigkft8YPSiwBbE3aRTlpMeLGAWy1yMGS XaSch2DtmnbR39O7saRg/ofko/f/sQdkd0ahrxX6/02hj5wa+pZfbPeEbzWDwE0qbsH/ KYCg== X-Received: by 10.50.37.162 with SMTP id z2mr10907306igj.13.1361386984895; Wed, 20 Feb 2013 11:03:04 -0800 (PST) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPS id as6sm14229703igc.8.2013.02.20.11.03.03 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Feb 2013 11:03:04 -0800 (PST) Message-ID: <51251DE5.2090703@dev.mellanox.co.il> Date: Wed, 20 Feb 2013 14:03:01 -0500 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Dan Ben-Yosef Subject: [PATCH] opensm/osm_qos_policy.c: fix memory leak when parsing policy file X-Gm-Message-State: ALoCoQkKrULrgY8G063Yg+O9ud8l1sIWiZrvclmZ1o7xaDb4X6CxtZ+F0KQbQub7P1wvEMqapAs9 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org We need to free the pkey_range_arr before parsing the qos file. Signed-off-by: Dan Ben Yosef --- } -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/opensm/osm_qos_policy.c b/opensm/osm_qos_policy.c index 1751849..e61392f 100644 --- a/opensm/osm_qos_policy.c +++ b/opensm/osm_qos_policy.c @@ -283,15 +283,16 @@ void osm_qos_policy_qos_level_destroy(osm_qos_level_t * p) if (!p) return; - if (p->name) - free(p->name); - if (p->use) - free(p->use); + free(p->name); + free(p->use); for (i = 0; i < p->path_bits_range_len; i++) free(p->path_bits_range_arr[i]); - if (p->path_bits_range_arr) - free(p->path_bits_range_arr); + free(p->path_bits_range_arr); + + for(i = 0; i < p->pkey_range_len; i++) + free((p->pkey_range_arr[i])); + free(p->pkey_range_arr); free(p);