Fix SCA and CID issues

Fix some issues found via cppcheck, some of them fix also some CID issues:
- change RGWOp::name() to return string instead of char* (also CID#1049250, CID#1049251 and CID#1049252)
- use static_cast<>() instead of C-Style cast
- don't free object twice, free the right one (also CID#1049247 and CID#1049218)
- reduce scope of local variable
- pass const std::list<> by reference

You may need to pull #451 before this one.