From: Martin Quinson Date: Sat, 27 Oct 2018 20:02:36 +0000 (+0200) Subject: try to please sonar on this ugly code X-Git-Tag: v3_22~844 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4bbdef278b030346b003663a70ce6e0ea459ee32?ds=sidebyside try to please sonar on this ugly code --- diff --git a/src/xbt/backtrace.cpp b/src/xbt/backtrace.cpp index cd3c902bb7..ed512992a3 100644 --- a/src/xbt/backtrace.cpp +++ b/src/xbt/backtrace.cpp @@ -128,10 +128,11 @@ static std::string get_binary_path() char* path = getenv("PATH"); if (path == nullptr) return ""; + XBT_DEBUG("Looking in the PATH: %s\n", path); std::vector path_list; - // TODO, on Windows, this is ";" - boost::split(path_list, path, boost::is_any_of(":")); + boost::split(path_list, path, boost::is_any_of(":;")); + for (std::string const& path_item : path_list) { std::string binary_name = simgrid::xbt::string_printf("%s/%s", path_item.c_str(), xbt_binary_name); bool found = (stat(binary_name.c_str(), &stat_buf) == 0); @@ -341,7 +342,7 @@ std::vector resolve_backtrace(xbt_backtrace_location_t const* loc, break; } pclose(pipe); - free(backtrace_syms); + xbt_free(backtrace_syms); #endif /* ADDR2LINE usable to resolve the backtrace */ return result; }