Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2043 closed defect (fixed)

Inserting histogram and color table into HFA file causes duplicate entries

Reported by: Sam Gillingham Owned by: warmerdam
Priority: normal Milestone: 1.4.5
Component: GDAL_Raster Version: 1.4.4
Severity: normal Keywords: hfa
Cc:

Description

Creates duplicate 'Descriptor_Table' entries that cause Imagine to crash. The proposed patch introduces tests into both the histogram code and color table code to ensure that 'Descriptor_Table', '#Bin_Function#', 'Histogram' nodes and the colour nodes are re-used if they already exist.

Attachments (1)

hfa.zip (1.3 KB) - added by Sam Gillingham 12 years ago.
Proposed patch to prevent duplicate nodes being added

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by Sam Gillingham

Attachment: hfa.zip added

Proposed patch to prevent duplicate nodes being added

comment:1 Changed 12 years ago by warmerdam

Keywords: hfa added
Resolution: fixed
Status: newclosed

I was unable to reproduce this problem but the changes all seem sensible so I have applied them in trunk (r13201) and 1.4 branch (r13202).

comment:2 Changed 12 years ago by Even Rouault

Resolution: fixed
Status: closedreopened

I'm wondering if it will not cause memory leaks. The patch adds 'new HFAEntry()' calls without freeing the previous object (if it was freeabled) or freeing itself.

comment:3 Changed 12 years ago by Sam Gillingham

Unless I made a mistake in the patch, the existing 'new HFAEntry()' calls are wrapped with a test to reuse the existing node if it exists. So there shouldn't be any new objects created.

comment:4 Changed 12 years ago by warmerdam

Resolution: fixed
Status: reopenedclosed

Even,

I see no sign how this code would introduce new leaks. If you can substantiate your concern with valgrind please reopen the report.

comment:5 Changed 12 years ago by Even Rouault

You're right, no leak. I didn't realize that 'new HFAEntry()' was chaining the new object to other existing objects ! That's a rather uncommon coding pattern that I missed in my very quick review of the commit.

Note: See TracTickets for help on using tickets.