Opened 13 years ago

Closed 13 years ago

#273 closed enhancement (fixed)

The map ADT should not free the object if its addition to the map failed

Reported by: Jakub Jermář Owned by: Petr Koupy
Priority: major Milestone: 0.5.0
Component: helenos/lib/c Version:
Keywords: Cc:
Blocker for: Depends on:
See also:


The map ADTs (e.g. the generic char map) will free up the memory for an object which it failed to insert (e.g. it was already there or it ran out of memory during the add operation).

In fact, the map ADTs should never free the memory occupied by the mapped object. The current networking code may rely on this behavior, but this should rather be changed.

Attachments (1)

ticket273.patch (22.0 KB ) - added by Petr Koupy 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Jakub Jermář, 13 years ago


comment:2 by Jakub Jermář, 13 years ago

Type: defectenhancement

comment:3 by Petr Koupy, 13 years ago

Owner: set to Petr Koupy
Status: newassigned
Version 0, edited 13 years ago by Petr Koupy (next)

by Petr Koupy, 13 years ago

Attachment: ticket273.patch added

comment:4 by Petr Koupy, 13 years ago

Operation for adding items into generic_char_map no longer deallocates given
object (i.e. behaves the same way as int_map and generic_field, leaving the
deallocation to the user).

Operations for exclusion and destruction of items in generic_char_map, int_map
and generic_field accept new argument - function pointer to the user-defined
destructor of the mapped objects. NULL pointer might be passed to allow fully
manual deallocation in the user code. Pointer to generic free() might be
passed as well.

Minor modifications have been made to the dependent networking code to work
with the new interface.

comment:5 by Jakub Jermář, 13 years ago

Resolution: fixed
Status: assignedclosed

Fix merged in changeset:mainline,902.

Note: See TracTickets for help on using tickets.