Ticket #8485 (closed)

Opened 7 years ago

Last modified 5 years ago

Fix unreleased use of POCO::XML document and nodelists in DataHandling code

Reported by: Karl Palmen Owned by: Karl Palmen
Priority: major Milestone: Release 3.2
Component: Framework Keywords: maintenance
Cc: Blocked By:
Blocking: #10637 Tester: Jay Rainey

Description (last modified by Karl Palmen) (diff)

In the code of framework/datahandling I found numerous cases of POCO::XML document or nodelist objects being created, but not released. This could cause memory leakage. Fix by using AutPtr for the object.

Change History

comment:1 Changed 7 years ago by Karl Palmen

AutoPtr is preferred to release().

comment:2 Changed 7 years ago by Karl Palmen

  • Description modified (diff)

comment:3 Changed 7 years ago by Karl Palmen

  • Description modified (diff)

comment:4 Changed 7 years ago by Karl Palmen

  • Status changed from new to inprogress
  • Owner set to Karl Palmen

comment:5 Changed 7 years ago by Karl Palmen

  • Milestone changed from Backlog to Release 3.2

comment:6 Changed 7 years ago by Karl Palmen

Use AutoPtr for NodeLists not released re #8485

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 73b6c869d1ebd478fce2392c421ab9074fffb4c0

comment:7 Changed 7 years ago by Karl Palmen

Use AutoPtr for a Document re #8485

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: fe0de606cbe52f2120917d385e81f2148bf355ff

comment:8 Changed 7 years ago by Karl Palmen

Tidy up code a little re #8485

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: beba8036a8a10c1ebdd62f15d4d5748a42d9668c

comment:9 Changed 7 years ago by Karl Palmen

To test check that all cases within Datahandling have been dealt with using AutoPtr, but cases that already use release() are left alone.

comment:10 Changed 7 years ago by Karl Palmen

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:11 Changed 7 years ago by Russell Taylor

  • Status changed from verify to reopened
  • Resolution fixed deleted

I would like to see all the places that use release() converted to AutoPtr as well, as this is better practice and exception-safe. Look at LoadSpice2D for example - in both of the places that pDoc->release() features an exception can be thrown before you get to that line, producing a leak.

comment:12 Changed 7 years ago by Karl Palmen

  • Status changed from reopened to inprogress

comment:13 Changed 7 years ago by Karl Palmen

Use AutoPtr in those cases where release() is used re #8485

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 53614ab7c5289d0391082610bb72ad0111fd1062

comment:14 Changed 7 years ago by Karl Palmen

  • Status changed from inprogress to verify
  • Resolution set to fixed

To test check that all cases for Document and Nodelist within Datahandling have been dealt with using AutoPtr.

comment:15 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester set to Martyn Gigg

comment:16 Changed 7 years ago by Martyn Gigg

A quick search for "->release" in DataHandling reveals another still lurking in LoadCanSAS1D2.cpp

./Framework/DataHandling/src/LoadCanSAS1D2.cpp:224:    tdataElemList->release();

comment:17 Changed 7 years ago by Martyn Gigg

  • Status changed from verifying to reopened
  • Resolution fixed deleted

comment:18 Changed 7 years ago by Karl Palmen

tdataElemList is neither a Document nor a NodeList pointer (it's a Node pointer) so is not strictly within the scope of the ticket. It is also not trivial to fix because of a dynamic cast.

comment:19 Changed 7 years ago by Karl Palmen

A closer look at the code showed it is a NodeList pointer, so will be fixed.

comment:20 Changed 7 years ago by Karl Palmen

  • Status changed from reopened to inprogress

comment:21 Changed 7 years ago by Karl Palmen

Make remaining fix in LoadCanSAS1D2.cpp re #8485

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 72531ed4e4e9ed38035cb33182ea7e615b74e5d2

comment:22 Changed 7 years ago by Karl Palmen

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:23 Changed 7 years ago by Jay Rainey

  • Status changed from verify to verifying
  • Tester changed from Martyn Gigg to Jay Rainey

comment:24 Changed 7 years ago by Jay Rainey

  • Status changed from verifying to reopened
  • Resolution fixed deleted

Although tdataElemList was made an AutoPtr in comment:21, release() is still being called - here. Other than that, all the changes made address the issue of this ticket in /DataHandling.

Last edited 7 years ago by Jay Rainey (previous) (diff)

comment:25 Changed 7 years ago by Karl Palmen

  • Status changed from reopened to inprogress

Remove release statement re #8485

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: db6a92bed99567573189a80bd565b6f0b7751136

comment:26 Changed 7 years ago by Karl Palmen

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:27 Changed 7 years ago by Jay Rainey

  • Status changed from verify to verifying

comment:28 Changed 7 years ago by Jay Rainey

  • Status changed from verifying to reopened
  • Resolution fixed deleted

The release mentioned in comment:24 has been addressed in comment:25. Code changes made are sensible. All occurences of Document* and Nodelist* in /DataHandling are now using AutoPtr.

I do have one minor issue. Inside LoadSpice2D.cpp, Element.h is included and the namespace is used. However, it's not used anywhere in this class. As that's not exactly related to this ticket, it should be addressed in another.

Last edited 7 years ago by Jay Rainey (previous) (diff)

comment:29 Changed 7 years ago by Jay Rainey

  • Status changed from reopened to closed

Merge remote-tracking branch 'origin/feature/8485_poco_xml_autoptr'

Full changeset: 7dd3d80e586eb73307baf1a3e49f9c3f1d3f1d53

comment:30 Changed 6 years ago by Federico M Pouzols

  • Blocking 10637 added

comment:31 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9329

Note: See TracTickets for help on using tickets.