diff options
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index e90abde47de0..d74be04ceeff 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1758,11 +1758,16 @@ static struct rbd_obj_request *rbd_obj_request_create(const char *object_name, | |||
1758 | rbd_assert(obj_request_type_valid(type)); | 1758 | rbd_assert(obj_request_type_valid(type)); |
1759 | 1759 | ||
1760 | size = strlen(object_name) + 1; | 1760 | size = strlen(object_name) + 1; |
1761 | obj_request = kzalloc(sizeof (*obj_request) + size, GFP_KERNEL); | 1761 | name = kmalloc(size, GFP_KERNEL); |
1762 | if (!obj_request) | 1762 | if (!name) |
1763 | return NULL; | ||
1764 | |||
1765 | obj_request = kzalloc(sizeof (*obj_request), GFP_KERNEL); | ||
1766 | if (!obj_request) { | ||
1767 | kfree(name); | ||
1763 | return NULL; | 1768 | return NULL; |
1769 | } | ||
1764 | 1770 | ||
1765 | name = (char *)(obj_request + 1); | ||
1766 | obj_request->object_name = memcpy(name, object_name, size); | 1771 | obj_request->object_name = memcpy(name, object_name, size); |
1767 | obj_request->offset = offset; | 1772 | obj_request->offset = offset; |
1768 | obj_request->length = length; | 1773 | obj_request->length = length; |
@@ -1808,6 +1813,7 @@ static void rbd_obj_request_destroy(struct kref *kref) | |||
1808 | break; | 1813 | break; |
1809 | } | 1814 | } |
1810 | 1815 | ||
1816 | kfree(obj_request->object_name); | ||
1811 | kfree(obj_request); | 1817 | kfree(obj_request); |
1812 | } | 1818 | } |
1813 | 1819 | ||