From patchwork Mon Aug 30 13:14:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Roponen X-Patchwork-Id: 142441 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 o7UDEP3Q032297 for ; Mon, 30 Aug 2010 13:14:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752147Ab0H3NOV (ORCPT ); Mon, 30 Aug 2010 09:14:21 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:49161 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752015Ab0H3NOV (ORCPT ); Mon, 30 Aug 2010 09:14:21 -0400 Received: by fxm13 with SMTP id 13so3177587fxm.19 for ; Mon, 30 Aug 2010 06:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:x-x-sender:to:cc :subject:message-id:user-agent:mime-version:content-type; bh=kL/BnIH095kELo0oSDPLJDg4n28IK2Tn28p3ryA72N4=; b=AzHmS6lZ5rwT9In1fqMHAgOuHMqtKglKnB4//hGbp2z0qKFa8IqZscJyQz2mUOt6zg yDZVlvQOOFNcwDe51EvjPTZeE34csRzTw4w2rlUrgCmuqCN0liMpNlFz0c5Udcn/4JW5 E6Kwlm1VhAhzOvVJxrALjBz9agru41VmcGZ8A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:x-x-sender:to:cc:subject:message-id:user-agent :mime-version:content-type; b=kYZqrajq6gu0iQRRpnsUskWVg7EzUynNHM0ntcQsMMwaX7u084l32WD8s6e2Gu/rKA q0zZ3Ai7/NIoes3WfTKs8VLxEYKByPJtm/A+AMmRXIoxmfyGm9lRW3YS2P8xEiXkGTHj 8ETrvWZAQOeDuPU2IzRJtg+rhafOlwcqmUTMc= Received: by 10.223.105.132 with SMTP id t4mr3743004fao.75.1283174059806; Mon, 30 Aug 2010 06:14:19 -0700 (PDT) Received: from terrop (e82-103-227-224.elisa-laajakaista.fi [82.103.227.224]) by mx.google.com with ESMTPS id h12sm2912984faa.13.2010.08.30.06.14.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 30 Aug 2010 06:14:19 -0700 (PDT) Date: Mon, 30 Aug 2010 16:14:06 +0300 (EEST) From: Tero Roponen X-X-Sender: terrop@localhost6.localdomain6 To: linux-btrfs@vger.kernel.org cc: chris.mason@oracle.com, josef@redhat.com Subject: btrfs: Free correct pointer after using strsep Message-ID: User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 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.3 (demeter1.kernel.org [140.211.167.41]); Mon, 30 Aug 2010 13:14:32 +0000 (UTC) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 1776dbd..9e2c9ec 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -260,7 +260,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, *orig, *p; int error = 0; int intarg; @@ -275,6 +275,8 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, if (!opts) return -ENOMEM; + orig = opts; + while ((p = strsep(&opts, ",")) != NULL) { int token; if (!*p) @@ -309,7 +311,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, } out_free_opts: - kfree(opts); + kfree(orig); out: /* * If no subvolume name is specified we use the default one. Allocate