You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code inside pipeline::start methods (overloads accepting callback) is dangerous and could be a potential source of memory leak:
template<class S>
pipeline_profile start(const config& config, S callback)
{
rs2_error* e = nullptr;
auto p = std::shared_ptr<rs2_pipeline_profile>(
rs2_pipeline_start_with_config_and_callback_cpp(_pipeline.get(), config.get().get(), new frame_callback<S>(callback), &e),
rs2_delete_pipeline_profile);
error::handle(e);
return pipeline_profile(p);
}
Problem statement:
The ownership of the memory allocated for the frame_callback object is passed to rs2_pipeline_start_with_callback_cpp function however there are control flows where the memory will not be properly released:
argument evaluation order is unspecified and config.get() may throw an exception while memory is already allocated
there is a case inside the rs2_pipeline_start_with_config_and_callback_cpp implementation when an exception may happen before ownership of the passed memory is accepted.
The text was updated successfully, but these errors were encountered:
Issue Description
The code inside
pipeline::start
methods (overloads accepting callback) is dangerous and could be a potential source of memory leak:Problem statement:
The ownership of the memory allocated for the
frame_callback
object is passed tors2_pipeline_start_with_callback_cpp
function however there are control flows where the memory will not be properly released:config.get()
may throw an exception while memory is already allocatedrs2_pipeline_start_with_config_and_callback_cpp
implementation when an exception may happen before ownership of the passed memory is accepted.The text was updated successfully, but these errors were encountered: