mirror of
https://github.com/ceph/ceph
synced 2025-01-10 13:10:46 +00:00
librbd: use delete[] properly
==4986== Mismatched free() / delete / delete [] ==4986== at 0x4C2658C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==4986== by 0x4ED8EA9: librbd::ImageCtx::~ImageCtx() (ImageCtx.cc:100) ==4986== by 0x4EF3827: librbd::close_image(librbd::ImageCtx*) (internal.cc:1869) ==4986== by 0x4EE8FB8: librbd::clone(librados::IoCtx&, char const*, char const*, librados::IoCtx&, char const*, unsigned long, int*, unsigned long, int) (internal.cc:900) ==4986== by 0x4EC363C: rbd_clone2 (librbd.cc:553) ==4986== by 0x404C85: do_clone (fsx.c:836) ==4986== by 0x405639: test (fsx.c:1048) ==4986== by 0x406369: main (fsx.c:1523) ==4986== Address 0xd498b30 is 0 bytes inside a block of size 37 alloc'd ==4986== at 0x4C26CF7: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==4986== by 0x4ED9B4D: librbd::ImageCtx::init_layout() (ImageCtx.cc:164) ==4986== by 0x4ED9845: librbd::ImageCtx::init() (ImageCtx.cc:142) ==4986== by 0x4EF3449: librbd::open_image(librbd::ImageCtx*, bool) (internal.cc:1828) ==4986== by 0x4EE89E0: librbd::clone(librados::IoCtx&, char const*, char const*, librados::IoCtx&, char const*, unsigned long, int*, unsigned long, int) (internal.cc:871) ==4986== by 0x4EC363C: rbd_clone2 (librbd.cc:553) ==4986== by 0x404C85: do_clone (fsx.c:836) ==4986== by 0x405639: test (fsx.c:1048) ==4986== by 0x406369: main (fsx.c:1523) Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
4a7a81bb53
commit
98b93b5d3d
@ -97,7 +97,7 @@ namespace librbd {
|
||||
delete object_set;
|
||||
object_set = NULL;
|
||||
}
|
||||
delete format_string;
|
||||
delete[] format_string;
|
||||
}
|
||||
|
||||
int ImageCtx::init() {
|
||||
@ -159,7 +159,7 @@ namespace librbd {
|
||||
layout.fl_object_size = 1ull << order;
|
||||
layout.fl_pg_pool = data_ctx.get_id(); // FIXME: pool id overflow?
|
||||
|
||||
delete format_string;
|
||||
delete[] format_string;
|
||||
size_t len = object_prefix.length() + 16;
|
||||
format_string = new char[len];
|
||||
if (old_format) {
|
||||
|
Loading…
Reference in New Issue
Block a user