Skip to content

Conversation

@kohrt
Copy link
Contributor

@kohrt kohrt commented Jul 9, 2015

There is a memory leak in Freenect2::openDevice.
If it fails before line 740 the PacketPipeline will not be deleted. It could also happen when passing a wrong serial number.
If it fails after line 740 the PacketPipeline will be deleted by the destructor of Freenect2DeviceImpl.

I added the necessary delete instructions. We should note somewhere in the documentation that libfreenect2 takes over control of the pipeline object (including destruction) and that it should never be used or deleted by user code afterwards.

@floe
Copy link
Contributor

floe commented Jul 9, 2015

For the moment, could you just add a comment in libfreenect2.hpp? Then I can merge it in one go.

@floe floe added this to the 0.1 milestone Jul 9, 2015
@kohrt
Copy link
Contributor Author

kohrt commented Jul 9, 2015

done.

@HenningJ
Copy link
Contributor

HenningJ commented Jul 9, 2015

While we're on the subject of memory mangement, you could also add a comment on the FrameListener::onNewFrame() method that the frame pointer must be release in there.

@kohrt
Copy link
Contributor Author

kohrt commented Jul 9, 2015

There are probably some more parts where comments are useful. But this is out of the focus of this PR.

@floe
Copy link
Contributor

floe commented Jul 9, 2015

OK, merged. We'll probably need another comments/docs PR anyway.

floe added a commit that referenced this pull request Jul 9, 2015
@floe floe merged commit 9e56dd4 into OpenKinect:master Jul 9, 2015
@kohrt kohrt deleted the open_device_fix branch July 9, 2015 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants