Skip to content

Commit edc3eff

Browse files
fran6coxlz
authored andcommitted
Fixes memory leak
When listener doesn't take ownership it will leak the frame
1 parent 70df5fa commit edc3eff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/vt_rgb_packet_processor.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ void VTRgbPacketProcessor::process(const RgbPacket &packet)
164164
frame->gain = packet.gain;
165165
frame->gamma = packet.gamma;
166166

167-
listener_->onNewFrame(Frame::Color, frame);
167+
if (!listener_->onNewFrame(Frame::Color, frame)) {
168+
// The listener didn't take ownership of the frame, so we delete it
169+
delete frame;
170+
}
168171

169172
CFRelease(sampleBuffer);
170173
CFRelease(blockBuffer);

0 commit comments

Comments
 (0)