libmultipath: fix memory leak in checker_cleanup_thread
PATCH 1/1 libmultipath: fix memory leak in checker_cleanup_thread
If checker_cleanup_thread is called after cleanup_checkers, the checker_class will not be freed.
Here, we use free_checker_class instead of checker_class_unref in checker_cleanup_thread.
--- libmultipath/checkers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/checkers.c +1 -1
@@ -368,7 +368,7 @@ static void checker_cleanup_thread(void *arg) {struct checker_class *cls = arg; - (void )checker_class_unref (cls); + (void )free_checker_class (cls);rcu_unregister_thread (); }
Signature · 4 lines
-- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Quoted 17 lines · lixiaokeng
If
checker_cleanup_threadis called aftercleanup_checkers, thechecker_classwill not be freed.Here, we use
free_checker_classinstead ofchecker_class_unrefinchecker_cleanup_thread.Signed-off-by Lixiaokeng <[email protected]>--- libmultipath/checkers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libmultipath/checkers.c +0
-0
libmultipath/checkers.c static void checker_cleanup_thread(void *arg) · line 374
Quoted 8 lines
libmultipath/checkers.c +1
-1@@ -368,7 +368,7 @@ static void checker_cleanup_thread(void *arg) {struct checker_class *cls = arg; - (void )checker_class_unref (cls); + (void )free_checker_class (cls);rcu_unregister_thread (); }
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Martin Wilck
Reviewed-byQuoted 20 lines · Benjamin Marzinski
Quoted 19 lines · lixiaokeng
If
checker_cleanup_threadis called aftercleanup_checkers, thechecker_classwill not be freed.Here, we use
free_checker_classinstead ofchecker_class_unrefinchecker_cleanup_thread.Signed-off-by Lixiaokeng <[email protected]>---
libmultipath/checkers.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)libmultipath/checkers.c +0
-0@@ -368,7 +368,7 @@ static void checker_cleanup_thread(void *arg) { struct checker_class *cls = arg;
Quoted 9 lines
libmultipath/checkers.c static void checker_cleanup_thread(void *arg) · line 374
Quoted 6 lines
libmultipath/checkers.c +1
-1- (void)checker_class_unref(cls); + (void)free_checker_class(cls); rcu_unregister_thread(); }Reviewed-by Benjamin Marzinski <[email protected]>
Nit: The cast to void is wrong, as free_checker_class() is a void function anyway. I'll take the freedom to remove it when I apply this to the "queue" branch.
Thanks,
Martin
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel