md-cluster: Fix a memleak in an error handling path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 14 Apr 2017 06:08:03 +0000 (08:08 +0200)
committerShaohua Li <shli@fb.com>
Fri, 14 Apr 2017 15:08:29 +0000 (08:08 -0700)
We know that 'bm_lockres' is NULL here, so 'lockres_free(bm_lockres)' is a
no-op. According to resource handling in case of error a few lines below,
it is likely that 'bitmap_free(bitmap)' was expected instead.

Fixes: b98938d16a10 ("md-cluster: introduce cluster_check_sync_size")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/md-cluster.c

index b21ef58819f695acf5b95361cb2dfa4694f9a6fa..7299ce2f08a810555a0407a423a512a0f59f190c 100644 (file)
@@ -1127,7 +1127,7 @@ int cluster_check_sync_size(struct mddev *mddev)
                bm_lockres = lockres_init(mddev, str, NULL, 1);
                if (!bm_lockres) {
                        pr_err("md-cluster: Cannot initialize %s\n", str);
-                       lockres_free(bm_lockres);
+                       bitmap_free(bitmap);
                        return -1;
                }
                bm_lockres->flags |= DLM_LKF_NOQUEUE;