ironbee/ironbee — Issue #16: Memory leak managing ib_field_val_t
Author: niq
Created: 2011-12-09 19:59:09+00:00
State: open

The union u field in ib_field_val_t leaks when it is allocated. This is a per-connection leak in the webserver/proxy plugins.

==1888== at 0x4C26FDE: malloc (vg_replace_malloc.c:236)
==1888== by 0xE62595C: bstr_alloc (bstr.c:33)
==1888== by 0xEA57CB0: ib_bytestr_create (bytestr.c:92)
==1888== by 0xEA57D32: ib_bytestr_alias_mem (bytestr.c:184)
==1888== by 0xEA5833D: ib_field_alias_mem_ex (field.c:309)
==1888== by 0xE842BCA: ib_data_add_bytestr_ex (data.c:145)
==1888== by 0xEC60460: ironbee_conn_init (ironbee.c:651)

This is complex to deal with ad-hoc when it arises. Ideally ib_field_val_t should have a record of whether the value needs freeing, and a destructor to deal with it.