From d4b8d9011929d534e5c98f0f19ab85bee8aeb971 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Thu, 12 Mar 2015 21:55:33 +0100 Subject: [PATCH] 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 --- src/test/librbd/test_librbd.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index cf76c67c7b645..cb39c6d45944f 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;