From patchwork Mon Jan 17 19:39:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 484641 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 p0HJdbVi025232 for ; Mon, 17 Jan 2011 19:39:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752603Ab1AQTjM (ORCPT ); Mon, 17 Jan 2011 14:39:12 -0500 Received: from mail-fx0-f46.google.com ([209.85.161.46]:62403 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751658Ab1AQTjL (ORCPT ); Mon, 17 Jan 2011 14:39:11 -0500 Received: by fxm20 with SMTP id 20so6401986fxm.19 for ; Mon, 17 Jan 2011 11:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=EuWrkSZg98gvqL+8W6xEieO3Ha/UyqwMU3UG/5Q4HGE=; b=HeL5GluankkHwICs/NTQ4MFJ4LK5mex5cgs8O7A8ERWnRajQBH3YbVY7QAplKQTS7F eVOaaGRbkG9GPKdTNAE/UridArqDp8uPOMKUinq8sCru8/G3kd4TJFR+00wrzr8uESpE h4W9zwI2XTKt1FP54+yxv0HhlG0QZXnBnaLmk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=A1lWTe/ZsAA51YZSwVAwkWdyLBcNGxq08WGRMnaiElveMA+/aR0z7siXyVTOL02gLx zwYdFYs7fzSoguAK3Thaj9HuKuE1/jj8G8F81icDU4QclArn0bG3bJ3o9YWsXRsYIAcY ScawMZM8Lj49plm2u7v6P7xoBdpjmS0UwF0Lk= Received: by 10.223.70.193 with SMTP id e1mr5185690faj.91.1295293149491; Mon, 17 Jan 2011 11:39:09 -0800 (PST) Received: from localhost ([109.110.82.162]) by mx.google.com with ESMTPS id n1sm1814604fam.40.2011.01.17.11.39.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 Jan 2011 11:39:08 -0800 (PST) Date: Mon, 17 Jan 2011 21:39:10 +0200 From: Ilya Dryomov To: linux-btrfs@vger.kernel.org Cc: Chris Mason , linux-kernel@vger.kernel.org Subject: [PATCH] Btrfs: fix memory leak in btrfs_parse_early_options() Message-ID: <20110117193910.GA26094@kwango.lan.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 17 Jan 2011 19:39:37 +0000 (UTC) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 883c6fa..291b630 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -277,7 +277,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, struct btrfs_fs_devices **fs_devices) { substring_t args[MAX_OPT_ARGS]; - char *opts, *p; + char *opts, *opts_orig, *p; int error = 0; int intarg; @@ -288,7 +288,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, * strsep changes the string, duplicate it because parse_options * gets called twice */ - opts = kstrdup(options, GFP_KERNEL); + opts = opts_orig = kstrdup(options, GFP_KERNEL); if (!opts) return -ENOMEM; @@ -326,7 +326,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, } out_free_opts: - kfree(opts); + kfree(opts_orig); out: /* * If no subvolume name is specified we use the default one. Allocate