From patchwork Mon Feb 4 13:20:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 2091941 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 3ED143FD56 for ; Mon, 4 Feb 2013 13:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755333Ab3BDNUU (ORCPT ); Mon, 4 Feb 2013 08:20:20 -0500 Received: from mail-ve0-f180.google.com ([209.85.128.180]:41550 "EHLO mail-ve0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755236Ab3BDNUT (ORCPT ); Mon, 4 Feb 2013 08:20:19 -0500 Received: by mail-ve0-f180.google.com with SMTP id jx10so4633496veb.39 for ; Mon, 04 Feb 2013 05:20:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=qiLAb2ZkSxfUXblH3Th2l4TnCNzty0BWl2yRVp6UJMc=; b=XFiLPiWCAbmvynKxs0JR7dDEzyXAldTnkAdva/q+zcQiigbaoXZhCferC9q20+1KPB howe3/vG3eP5w6SiwrELLQuKDPFUE7Friq5fZjH8/HBq9VCQGyk82vNiTs777fwv29CE S4qacabY8jZTeJsPpitGlauN6eng+Wxyojp80oaKVDUnAqhWhvymTKGcfr2ZsGsUb6w3 nNWPVCTa5DniL1osawZf+xRdU6gAdzuqpfc4QD7RwEjO3YvbvGIQlIkiZCVKtWWBYRyM z0xowjb+/3U1cKJ0DiEDZf4P10HzZj65P5V+/RBXp99d01rJBnZWu7xOzjRbWUesxIm7 gXpw== X-Received: by 10.52.97.7 with SMTP id dw7mr19510180vdb.38.1359984018725; Mon, 04 Feb 2013 05:20:18 -0800 (PST) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPS id l18sm21623340vdh.10.2013.02.04.05.20.16 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 04 Feb 2013 05:20:17 -0800 (PST) From: Alex Netes To: linux-rdma@vger.kernel.org Cc: Shlomi Nimrodi , Alex Netes Subject: [PATCH] opensm/osm_qos_policy.c: fix segmentation fault on osm_qos_policy_match_rule_destroy (osm_qos_policy.c) Date: Mon, 4 Feb 2013 15:20:02 +0200 Message-Id: <1359984011-30753-1-git-send-email-alexne@mellanox.com> X-Mailer: git-send-email 1.7.11.7 X-Gm-Message-State: ALoCoQnUQe9PSWsTNQCwjJcokX4Zk/NxUY7EEbJ5cF7HireqWe1/9vb+rrCdj2ZSErUF9cUhoBsV Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Shlomi Nimrodi Signed-off-by: Shlomi Nimrodi Signed-off-by: Alex Netes --- opensm/osm_qos_policy.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/opensm/osm_qos_policy.c b/opensm/osm_qos_policy.c index c8526b9..ad5eaa0 100644 --- a/opensm/osm_qos_policy.c +++ b/opensm/osm_qos_policy.c @@ -373,20 +373,23 @@ void osm_qos_policy_match_rule_destroy(osm_qos_match_rule_t * p) if (p->use) free(p->use); - for (i = 0; i < p->service_id_range_len; i++) - free(p->service_id_range_arr[i]); - if (p->service_id_range_arr) + if (p->service_id_range_arr) { + for (i = 0; i < p->service_id_range_len; i++) + free(p->service_id_range_arr[i]); free(p->service_id_range_arr); + } - for (i = 0; i < p->qos_class_range_len; i++) - free(p->qos_class_range_arr[i]); - if (p->qos_class_range_arr) + if (p->qos_class_range_arr) { + for (i = 0; i < p->qos_class_range_len; i++) + free(p->qos_class_range_arr[i]); free(p->qos_class_range_arr); + } - for (i = 0; i < p->pkey_range_len; i++) - free(p->pkey_range_arr[i]); - if (p->pkey_range_arr) + if (p->pkey_range_arr) { + for (i = 0; i < p->pkey_range_len; i++) + free(p->pkey_range_arr[i]); free(p->pkey_range_arr); + } cl_list_apply_func(&p->source_list, __free_single_element, NULL); cl_list_remove_all(&p->source_list);