afs: Fix memory leak in afs_put_sysnames()
authorZhihao Cheng <chengzhihao1@huawei.com>
Tue, 2 Jun 2020 01:30:45 +0000 (09:30 +0800)
committerDavid Howells <dhowells@redhat.com>
Tue, 9 Jun 2020 14:22:06 +0000 (15:22 +0100)
Fix afs_put_sysnames() to actually free the specified afs_sysnames
object after its reference count has been decreased to zero and
its contents have been released.

Fixes: 6f8880d8e681557 ("afs: Implement @sys substitution handling")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/proc.c

index 22d00cf1913d1e37f33535925c2a67a6563667c8..e817fc740ba019bfb27b1e6d9af5a538f1152d79 100644 (file)
@@ -567,6 +567,7 @@ void afs_put_sysnames(struct afs_sysnames *sysnames)
                        if (sysnames->subs[i] != afs_init_sysname &&
                            sysnames->subs[i] != sysnames->blank)
                                kfree(sysnames->subs[i]);
+               kfree(sysnames);
        }
 }