libonvif icon indicating copy to clipboard operation
libonvif copied to clipboard

Memory leaks

Open peakpeak-github opened this issue 11 months ago • 4 comments

In onvif.c, line 1822 you return without freeing xmlXPathObjectPtr result, i.e xmlXPathFreeObject(result); is missing before the return, causing a memory leak.

peakpeak-github avatar Sep 20 '23 13:09 peakpeak-github

You are correct that this will cause a memory leak, thank you for pointing this out. There are even a couple more similar conditions in lines 1868 and 1873. I am releasing a new version shortly, these fixes will be included.

Your feedback is greatly appreciated.

sr99622 avatar Sep 21 '23 13:09 sr99622

Did you use valgrind to discover these memory leaks?

petterreinholdtsen avatar Dec 23 '23 23:12 petterreinholdtsen

Hi Petter,

It's nice to see your message, hope all is well. The leak can be seen from the code, there is a close command that should follow that was missed. These leaks are pretty small, so they wouldn't be noticed in most situations, but should be fixed.

I haven't used valgrind in the past, but it might be worth looking at.

Best Regards,

Stephen

sr99622 avatar Dec 25 '23 01:12 sr99622

[Stephen Rhodes]

It's nice to see your message, hope all is well.

Thanks. Hope you are dowing well too.

The leak can be seen from the code, there is a close command that should follow that was missed. These leaks are pretty small, so they wouldn't be noticed in most situations, but should be fixed.

Glad to hear a fix is easy to make. Hope the new version will make it to Debian soon. :)

I haven't used valgrind in the past, but it might be worth looking at.

It is one of the tools that single handedly improvided Linux software quality, so definitely worth a look. :)

A simple "valgrind onvif-gui" run show a few issues that might be worth investigating. :)

-- Happy hacking Petter Reinholdtsen

petterreinholdtsen avatar Dec 25 '23 08:12 petterreinholdtsen