From patchwork Tue Aug 20 13:00:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2847079 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4D8E29F239 for ; Tue, 20 Aug 2013 13:01:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EB4D20304 for ; Tue, 20 Aug 2013 13:01:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E11322021C for ; Tue, 20 Aug 2013 13:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751410Ab3HTNA7 (ORCPT ); Tue, 20 Aug 2013 09:00:59 -0400 Received: from mail-ee0-f43.google.com ([74.125.83.43]:38822 "EHLO mail-ee0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010Ab3HTNA6 (ORCPT ); Tue, 20 Aug 2013 09:00:58 -0400 Received: by mail-ee0-f43.google.com with SMTP id e52so191899eek.2 for ; Tue, 20 Aug 2013 06:00:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=74Mp8CFjBDNXIZKgyNBGOUGFKKSI/u9W1Op9gPNQYwY=; b=Hj5n9cJVfvqr0AMhZsgxAsxOC+Mh2DqzXlCP6yZGOz5QEtqWazTFKwygEGyTePbcmV Tss3liuQsR+iIiHqe/hhRTEDt3BBEEyiHHzqaOxeAw5+c8sGYtgzBNjg9V5uzEUAMrc5 Kq/h64kpguUQE0H+lDqRtYDyemNte05QMxHJJfg83cf00BlyiXDGn0tp9sfaZKXCA9q1 jFpQWeLTAExpo7NVrGNn/h/Cyw7cQHsmtON6Mw35h5WQwT2mpiXHanYluxz84u6EWbrE z3hO/wzneS33Nl/Jj9uAduRGgiJcCb/xng7LbUFUy6O3XFqmsNi8zfCXwP/N/pmCFUca GruA== X-Gm-Message-State: ALoCoQkHFUv5BJNbIabmmZruAsEgo/9xP1gt/6jMXAPj9lApba5XZnTAIBPSdRsO6jWUsVqBGr3P X-Received: by 10.14.89.72 with SMTP id b48mr2233604eef.43.1377003656790; Tue, 20 Aug 2013 06:00:56 -0700 (PDT) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id l47sm2244965eex.15.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Aug 2013 06:00:56 -0700 (PDT) Message-ID: <52136886.7090905@dev.mellanox.co.il> Date: Tue, 20 Aug 2013 09:00:54 -0400 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: Vladimir Koushnir Subject: [PATCH opensm] osm_subnet.c: Fix memory leak caused by commit dc0760cb8088fbe079e19682570a884ba01e94ff Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vladimir Koushnir double strdup for p_opt->dump_files_dir is causing memory leak Signed-off-by: Vladimir Koushnir Signed-off-by: Hal Rosenstock --- -- 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_subnet.c b/opensm/osm_subnet.c index 7ab1671..4b5ef38 100644 --- a/opensm/osm_subnet.c +++ b/opensm/osm_subnet.c @@ -1498,7 +1498,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt) p_opt->dump_files_dir = getenv("OSM_TMP_DIR"); if (!p_opt->dump_files_dir || !(*p_opt->dump_files_dir)) - p_opt->dump_files_dir = strdup(OSM_DEFAULT_TMP_DIR); + p_opt->dump_files_dir = (char *) OSM_DEFAULT_TMP_DIR; p_opt->dump_files_dir = strdup(p_opt->dump_files_dir); p_opt->log_file = strdup(OSM_DEFAULT_LOG_FILE); p_opt->log_max_size = 0;