Opened 16 years ago

Closed 16 years ago

Last modified 16 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 16 years ago.
Proposed patch to prevent duplicate nodes being added

Download all attachments as: .zip

Change History (6)

by Sam Gillingham, 16 years ago

Attachment: hfa.zip added

Proposed patch to prevent duplicate nodes being added

comment:1 by warmerdam, 16 years ago

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 by Even Rouault, 16 years ago

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 by Sam Gillingham, 16 years ago

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 by warmerdam, 16 years ago

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 by Even Rouault, 16 years ago

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.