From: Danny Al-Gaaf Date: Sat, 10 May 2014 08:58:56 +0000 (+0200) Subject: test_librbd.cc: fix sizeof() in malloc call X-Git-Tag: v0.81~27^2~31 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fe750755740a8fc70e54cfbe4f0414b4f2ed4079;p=ceph.git test_librbd.cc: fix sizeof() in malloc call Use 'char' instead of 'char *'. 228 names = (char *) malloc(sizeof(char *) * 1024); Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'char *' Signed-off-by: Danny Al-Gaaf --- diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 7f354187277a..fdc33d3d3deb 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -225,7 +225,7 @@ int test_ls(rados_ioctx_t io_ctx, size_t num_expected, ...) va_list ap; size_t max_size = 1024; - names = (char *) malloc(sizeof(char *) * 1024); + names = (char *) malloc(sizeof(char) * 1024); int len = rbd_list(io_ctx, names, &max_size); for (i = 0, num_images = 0, cur_name = names; cur_name < names + len; i++) {