From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net ([212.227.17.20]:51017 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbeEVEZG (ORCPT ); Tue, 22 May 2018 00:25:06 -0400 From: Chengguang Xu To: linux-fsdevel@vger.kernel.org Cc: dsterba@suse.com, dhowells@redhat.com, jlayton@redhat.com, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, Chengguang Xu Subject: [PATCH] fs/affs: fix potential memory leak in option parsing Date: Tue, 22 May 2018 12:24:25 +0800 Message-Id: <1526963065-21134-1-git-send-email-cgxu519@gmx.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: When specifying option 'prefix' multiple times, current option parsing will cause memory leak. Hence, call kfree for previous one in this case. Signed-off-by: Chengguang Xu --- fs/affs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/affs/super.c b/fs/affs/super.c index e602619..d1ad11a 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -241,6 +241,7 @@ enum { affs_set_opt(*mount_opts, SF_NO_TRUNCATE); break; case Opt_prefix: + kfree(*prefix); *prefix = match_strdup(&args[0]); if (!*prefix) return 0; -- 1.8.3.1