Blame SOURCES/0074-fs-ntfs3-Fix-a-memory-leak-on-object-opts.patch

Kmods SIG d83023
From 880301bb313295a65523e79bc5666f5cf49eb3ed Mon Sep 17 00:00:00 2001
Kmods SIG d83023
From: Colin Ian King <colin.king@canonical.com>
Kmods SIG d83023
Date: Fri, 10 Sep 2021 11:02:02 +0100
Kmods SIG d83023
Subject: [Backport 880301bb3132] src: Fix a memory leak on object opts
Kmods SIG d83023
Kmods SIG d83023
Currently a failed allocation on sbi->upcase will cause an exit via
Kmods SIG d83023
the label free_sbi causing a memory leak on object opts. Fix this by
Kmods SIG d83023
re-ordering the exit paths free_opts and free_sbi so that kfree's occur
Kmods SIG d83023
in the reverse allocation order.
Kmods SIG d83023
Kmods SIG d83023
Addresses-Coverity: ("Resource leak")
Kmods SIG d83023
Fixes: 27fac77707a1 ("src: Init spi more in init_fs_context than fill_super")
Kmods SIG d83023
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Kmods SIG d83023
Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
Kmods SIG d83023
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Kmods SIG d83023
---
Kmods SIG d83023
 src/super.c | 4 ++--
Kmods SIG d83023
 1 file changed, 2 insertions(+), 2 deletions(-)
Kmods SIG d83023
Kmods SIG d83023
diff --git a/src/super.c b/src/super.c
Kmods SIG d83023
index cefb9ddaf4db78890e9dc389416f47323bf33bcd..6a535b144ff961036704ba5a5ac5b1cab7ae9fb4 100644
Kmods SIG d83023
--- a/src/super.c
Kmods SIG d83023
+++ b/src/super.c
Kmods SIG d83023
@@ -1393,10 +1393,10 @@ static int ntfs_init_fs_context(struct fs_context *fc)
Kmods SIG d83023
 	fc->ops = &ntfs_context_ops;
Kmods SIG d83023
 
Kmods SIG d83023
 	return 0;
Kmods SIG d83023
-free_opts:
Kmods SIG d83023
-	kfree(opts);
Kmods SIG d83023
 free_sbi:
Kmods SIG d83023
 	kfree(sbi);
Kmods SIG d83023
+free_opts:
Kmods SIG d83023
+	kfree(opts);
Kmods SIG d83023
 	return -ENOMEM;
Kmods SIG d83023
 }
Kmods SIG d83023
 
Kmods SIG d83023
-- 
Kmods SIG d83023
2.31.1
Kmods SIG d83023