# \[PATCH\] blkcg: fix double free of new\_blkg in blkcg\_init\_queue

- From: Hou Tao \<hidden\>
- Date: 2017-01-25 00:37:36 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2017/01/6370336
- Thread: https://ratatoskr.run/linux-block/2017/01/6370336/t.md

```text
if blkg_create fails, new_blkg passed as an argument will
be freed by blkg_create, so there is no need to free it again.

Signed-off-by: Hou Tao <redacted>
---
 block/blk-cgroup.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 8ba0af7..58fb0dd 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1080,7 +1080,6 @@ int blkcg_init_queue(struct request_queue *q)
 		radix_tree_preload_end();
 
 	if (IS_ERR(blkg)) {
-		blkg_free(new_blkg);
 		return PTR_ERR(blkg);
 	}
 
-- 
2.5.0
```
