From: Danny Al-Gaaf Date: Thu, 12 Mar 2015 20:55:33 +0000 (+0100) Subject: test_librbd.cc: fix USE_AFTER_FREE X-Git-Tag: v9.0.0~95^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d4b8d9011929d534e5c98f0f19ab85bee8aeb971;p=ceph.git test_librbd.cc: fix USE_AFTER_FREE Fix for: CID 1251462 (#1 of 1): Use after free (USE_AFTER_FREE) 1. alias: Assigning: cur_name = names. Now both point to the same storage. 3. freed_arg: free frees names. 6. pass_freed_arg: Passing freed pointer cur_name as an argument to printf. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index cf76c67c7b64..cb39c6d45944 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -333,7 +333,7 @@ int test_ls(rados_ioctx_t io_ctx, size_t num_expected, ...) printf("expected = %s\n", expected); std::set::iterator it = image_names.find(expected); if (it != image_names.end()) { - printf("found %s\n", cur_name); + printf("found %s\n", expected); image_names.erase(it); } else { ADD_FAILURE() << "Unable to find image " << expected;