Skip to content

Commit

Permalink
test_librbd.cc: fix USE_AFTER_FREE
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dalgaaf committed Mar 12, 2015
1 parent e6161b7 commit d4b8d90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/test/librbd/test_librbd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ int test_ls(rados_ioctx_t io_ctx, size_t num_expected, ...)
printf("expected = %s\n", expected);
std::set<std::string>::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;
Expand Down

0 comments on commit d4b8d90

Please sign in to comment.