From patchwork Tue Sep 7 15:04:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 161151 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 o87F0vGP032530 for ; Tue, 7 Sep 2010 15:04:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757087Ab0IGPEl (ORCPT ); Tue, 7 Sep 2010 11:04:41 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:51323 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752714Ab0IGPEl (ORCPT ); Tue, 7 Sep 2010 11:04:41 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from kliteyn@mellanox.co.il) with SMTP; 7 Sep 2010 18:03:59 +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:04:38 +0300 Message-ID: <4C865486.4040909@mellanox.co.il> Date: Tue, 7 Sep 2010 18:04:38 +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_subnet.c: fixing small bug in 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:04:42 +0000 (UTC) diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c index d5c5ab2..149ab85 100644 --- a/opensm/opensm/osm_subnet.c +++ b/opensm/opensm/osm_subnet.c @@ -1163,8 +1163,10 @@ int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * p_opts) cl_log_event("OpenSM", CL_LOG_INFO, line, NULL, 0); p_opts->config_file = file_name; - if (!p_opts->file_opts && !(p_opts->file_opts = malloc(sizeof(*p_opts)))) + if (!p_opts->file_opts && !(p_opts->file_opts = malloc(sizeof(*p_opts)))) { + fclose(opts_file); return -1; + } memcpy(p_opts->file_opts, p_opts, sizeof(*p_opts)); while (fgets(line, 1023, opts_file) != NULL) {