if (!rbd_dev->image_name)
goto out_err;
- /* Create the name of the header object */
-
- rbd_dev->header_name = kmalloc(rbd_dev->image_name_len
- + sizeof (RBD_SUFFIX),
- GFP_KERNEL);
- if (!rbd_dev->header_name)
- goto out_err;
- sprintf(rbd_dev->header_name, "%s%s", rbd_dev->image_name, RBD_SUFFIX);
-
/* Snapshot name is optional */
len = next_token(&buf);
if (!len) {
return snap_name;
out_err:
- kfree(rbd_dev->header_name);
- rbd_dev->header_name = NULL;
kfree(rbd_dev->image_name);
rbd_dev->image_name = NULL;
rbd_dev->image_name_len = 0;
goto err_out_client;
rbd_dev->pool_id = rc;
+ /* Create the name of the header object */
+
+ rbd_dev->header_name = kmalloc(rbd_dev->image_name_len
+ + sizeof (RBD_SUFFIX),
+ GFP_KERNEL);
+ if (!rbd_dev->header_name)
+ goto err_out_client;
+ sprintf(rbd_dev->header_name, "%s%s", rbd_dev->image_name, RBD_SUFFIX);
+
/* register our block device */
rc = register_blkdev(0, rbd_dev->name);
if (rc < 0)
err_out_blkdev:
unregister_blkdev(rbd_dev->major, rbd_dev->name);
err_out_client:
+ kfree(rbd_dev->header_name);
rbd_put_client(rbd_dev);
err_put_id:
if (rbd_dev->pool_name) {
kfree(rbd_dev->mapping.snap_name);
- kfree(rbd_dev->header_name);
kfree(rbd_dev->image_name);
kfree(rbd_dev->pool_name);
}