Skip to content

Commit

Permalink
Merge pull request #6417 from ev-mp/rs5-7715
Browse files Browse the repository at this point in the history
Memleak fix in frame-validator PB
  • Loading branch information
ev-mp authored May 19, 2020
2 parents c1a5955 + ba3d782 commit 5b5bdd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/frame-validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@ namespace librealsense
{
void frame_validator::on_frame(rs2_frame * f)
{
if (!_stopped && propagate((frame_interface*)f))
if (!_stopped && propagate((frame_interface*)f)
&& is_user_requested_frame((frame_interface*)f))
{
if(is_user_requested_frame((frame_interface*)f))
_user_callback->on_frame(f);
}
else
{
// No RAII - explicit release is required
((frame_interface*)f)->release();
}
}

void frame_validator::release()
{}

frame_validator::frame_validator(std::shared_ptr<sensor_base> sensor, frame_callback_ptr user_callback, stream_profiles current_requests, stream_profiles validator_requests) :
_sensor(sensor),
_user_callback(user_callback),
_stopped(false),
_validated(false),
_user_callback(user_callback),
_user_requests(current_requests),
_validator_requests(validator_requests),
_stopped(false),
_validated(false)
_sensor(sensor)
{}

frame_validator::~frame_validator()
Expand Down
2 changes: 1 addition & 1 deletion src/frame-validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace librealsense
{
public:
explicit frame_validator(std::shared_ptr<sensor_base> sensor, frame_callback_ptr user_callback, stream_profiles user_requests, stream_profiles validator_requests);
virtual ~frame_validator();
virtual ~frame_validator() override;

void on_frame(rs2_frame * f) override;
void release() override;
Expand Down

0 comments on commit 5b5bdd5

Please sign in to comment.