Bug #390
openMemory leaks in storescu, findscu und Co.
50%
Description
found with valgrind on caesar
It seems that 'ASC_destroyAssociation()' is not called in certain places in order to free the memory associated with the 'assoc' structure. This manifests itself in erroneous behaviour (e.g. unsuccessful negotiation of Presentation Contexts, no connection with the Communication Partner).
Associated Patch: "Added new class template "OFResourceHandle" for RAII-style (leak free) programming and used it to fix some memory leaks in storescu." T_ASC_Association_Handle is introduced in this template, which includes ASC_destroyAssociation's functionality.
If you replace all instances of T_ASC_Association with T_ASC_Association_Handle, ASC_destroyAssociation be called for each object. In some parts of the code, one must be careful as get() will be called on this handle to get the pointer.
In most cases the overloaded operators in OFResourceHandle should ensure that the handle will contain the pointer as before and not require that the code be adapted.
TODO:
- So far this has only been fixed in storescu, needs to be done for the others
- Test if all leaks have been fixed
- Adjust the scope of T_ASC_Association_Handle objects so that resources are released as early as possible and not at the end of main.
Files
Updated by Jan Schlamelcher about 13 years ago
- File ofhand.patch ofhand.patch added
- % Done changed from 0 to 50
Beiliegender Patch: "Added new class template "OFResourceHandle" for RAII-style (leak free) programming and used it to fix some memory leaks in storescu." Mit Hilfe dieses templates wurde das neue struct T_ASC_Association_Handle erstellt, was im destructor ASC_destroyAssociation ausfürt.
Somit wird diese funktion garantiert für jedes T_ASC_Association "Objekt" aufgerufen, sofern man alle Vorkomnisse von T_ASC_Association* variablen durch T_ASC_Association_Handle variablen ersetzt. An manchen stellen muss allerdings der code in soweit angepasst werden, dass get() von diesem handle aufgerufen wird um den normalen pointer zu bekommen. An den meisten stellen sorgen die in OFResourceHandle überladenen operatoren jedoch dafür, dass sich das handle genau so wie der pointer verhält und kein code angepasst werden muss.
TODO:
- Bisher wurde dieser fix nur in storescu angewand, muss also noch bei den Anderen gemacht werden.
- Testen ob alle leaks behoben sind.
- Eventuell den scope der T_ASC_Association_Handle Objekte anpassen, damit die resourcen möglichst früh freigegeben werden und nicht erst am Ende der main.
Updated by Andrew Chiw over 12 years ago
- Subject changed from Speicherlecks in storescu, findscu und Co. to Memory leaks in storescu, findscu und Co.
Updated by Marco Eichelberg over 8 years ago
- Priority changed from High to Normal
- Target version changed from 3.6.2 to 3.6.3
Updated by Marco Eichelberg over 7 years ago
- Target version changed from 3.6.3 to 3.6.6
Updated by Pedro Fernando Arizpe Gómez over 7 years ago
- Related to Bug #832: another echo SCU false positive added
Updated by Pedro Fernando Arizpe Gómez over 7 years ago
- Related to Bug #831: echo SCU false positive added