Opened 7 years ago

Closed 7 years ago

#4340 closed defect (fixed)

dynamically allocated memory is not initialized

Reported by: Heiko_Petzsch Owned by: jburgess777@…
Priority: critical Milestone:
Component: osm2pgsql Version:
Keywords: node-ram-cache, calloc Cc: Pavel Grechishkin

Description

Reading in an osm file into the database leads (always on my system) to the message "WARNING: Found Out of order node...", and no data is entered into the database.

Reason for this is a bug in the node-ram-cache code: memory for the cache is allocated with a call to malloc and therefore not initialized - the cache seems to be filled with data when in fact it is still empty.

Bug fix: perfom memory allocation in function init_node_ram_cache with calloc() instead of malloc().

Attachments (1)

calloc.diff (1.7 KB) - added by Pavel Grechishkin 7 years ago.
patch for revision 28379

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by Pavel Grechishkin

Attachment: calloc.diff added

patch for revision 28379

comment:1 Changed 7 years ago by Pavel Grechishkin

Cc: Pavel Grechishkin added

Thank you for bugfix, I spent over 4 days trying to make it work. On my system (opensuse 12.1) this caused segfaults. Now all seems working fine. Latest svn revision (28379).

comment:2 Changed 7 years ago by Pavel Grechishkin

Resolution: worksforme
Status: newclosed

comment:3 Changed 7 years ago by Pavel Grechishkin

Resolution: worksforme
Status: closedreopened

comment:4 Changed 7 years ago by amm

Resolution: fixed
Status: reopenedclosed

This should be fixed in r28387.

I modified the patch to fix a bug it contained, as it was allocating SAFTEY_MARGIN per element, rather than only once causing a large amount of excessive memory to be allocated.

I am not sure the previous behaviour actually caused problems, or just a warning though. I have so far not seen any segfaults caused by the previous behaviour.

Note: See TracTickets for help on using tickets.