intel / NMPRK

3 stars 10 forks source link

Memory leak #14

Closed jrmassoni closed 12 years ago

jrmassoni commented 12 years ago

Hi,

Yes, I have the current version, but the problem still exists.

Precisely: In the file nm_dcmi_linux.cpp (lines 48, 85, 124) there is a new intf struct created(or taken from previous connections). I think in disconnecting functions the memory should be freed. Instead of that structures are endlessly kept, and disconnecting function in file lan.c, line 2016, frees only the session component, and sets the intf struct pointer to null pointer. I think it’s not the most secure solution, especially when the application fails and closes unexpectedly.

Best Regards, Joanna Rozestwinska Intel Technology Poland Sp. z o.o. ul. Slowackiego 173 80-298 Gdansk

jrmassoni commented 12 years ago

delete()'s have been added to match the two new()'s in the routines mentioned. This will be in the next release.

jrmassoni commented 12 years ago

Deletes have been removed. The code was correct. This function creates structures that are passed back to the calling program and later used to set and delete policies and such. It is the calling program's resposibility to delete these structures after there is no use for them. Unfortunately the calling program doesn't know this and therefore will not delete those structures, thus resulting in a memory leak. These structures that are created either need to be documented or a new routine needs to be created clean up such structures. This will be left as a bug until documented, then probably moved to become an enhancement request.

jrmassoni commented 12 years ago

Updated the documentation to indicate that the calling application is responsible to delete this data structure after it has completed using it. Agree this isn't the best implementation, but then again it is only reference code and users can modify it to their suiting.