nbd: don't leak nbd_config
authorIlya Dryomov <idryomov@gmail.com>
Tue, 23 May 2017 15:49:55 +0000 (17:49 +0200)
committerJens Axboe <axboe@fb.com>
Tue, 30 May 2017 14:15:08 +0000 (08:15 -0600)
nbd_config is allocated in nbd_alloc_config(), but never freed.

Fixes: 5ea8d10802ec ("nbd: separate out the config information")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nbd.c

index e725d8d5ab0b2e321399f00804dd00d953f7184b..f3f191ba8ca4bbe6b7d87a7accc84bd648e4d718 100644 (file)
@@ -1021,6 +1021,7 @@ static void nbd_config_put(struct nbd_device *nbd)
                        }
                        kfree(config->socks);
                }
+               kfree(nbd->config);
                nbd->config = NULL;
 
                nbd->tag_set.timeout = 0;