From: Guilherme Maciel Ferreira Date: Tue, 13 Sep 2011 04:07:55 +0000 (-0300) Subject: Bug fix: return the boost::program_options::option_description by value X-Git-Tag: v1.3~11^2~34^2~20 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=16b1c7cd765dcbaf527d0acdefe92a00074037b4;p=pingcheck Bug fix: return the boost::program_options::option_description by value - If this object is returned by reference or smart pointer, the boost::program_options::options_description::add() method will delete it causing double free on that object. So we prevent any problem by not exposing the underlying object --- diff --git a/src/config/option/configurationoption.cpp b/src/config/option/configurationoption.cpp index da9bfbf..c281313 100644 --- a/src/config/option/configurationoption.cpp +++ b/src/config/option/configurationoption.cpp @@ -70,9 +70,9 @@ ConfigurationOption::~ConfigurationOption() /** * @return The underlining @c boost::program_options::option_description object. */ -shared_ptr ConfigurationOption::get_option_description() +option_description ConfigurationOption::get_option_description() { - return shared_ptr( &option ); + return option; } /** diff --git a/src/config/option/configurationoption.h b/src/config/option/configurationoption.h index e7552e5..7ee5079 100644 --- a/src/config/option/configurationoption.h +++ b/src/config/option/configurationoption.h @@ -50,7 +50,7 @@ public: ); virtual ~ConfigurationOption(); - boost::shared_ptr< boost::program_options::option_description > get_option_description(); + boost::program_options::option_description get_option_description(); std::string get_command_string() const; std::string get_command_description() const;