A memory leak can be seen when the following matched pair of commands is called, using a schema containing an AVRO_LINK. This pair of commands constructs a class (value iface) from a schema and then destroys the constructed class.
record_class = avro_generic_class_from_schema( schema );
avro_value_iface_decref( record_class );
If schema contains an AVRO_LINK, then avro_generic_class_from_schema() calls avro_generic_link_class(), which calls avro_schema_incref() on the AVRO_LINK target schema and assigns the target schema pointer to the iface->schema.
When we subsequently call avro_value_iface_decref() to deallocate the class, this function calls avro_generic_link_decref_iface(), which frees the memory for the link interface without calling avro_schema_decref() on the target schema pointed to by iface->schema.
Thus the memory of the target schema is leaked when we create and destroy a value interface for an AVRO_LINK.
Calling avro_schema_decref() on the the target schema (iface->schema) before calling avro_freet() on the iface fixes this memory leak.
Note: The pair of commands shown above results in a memory leak, when we create and destroy a value interface from any schema containing an AVRO_LINK, regardless of whether it is recursive or not. There is a separate issue regarding memory leaks with recursive schemas described in AVRO-766. The fix for this issue can only be tested with non-recursive schemas containing AVRO_LINKs until AVRO-766 is fixed.
|Transition||Time In Source Status||Execution Times||Last Executer||Last Execution Date|
|50m 33s||1||Vivek Nadkarni||14/Sep/12 19:30|
|3d 4h 48m||1||Douglas Creager||18/Sep/12 00:19|
|7d 21h 57m||1||Doug Cutting||25/Sep/12 22:16|
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Status||Patch Available [ 10002 ]||Resolved [ 5 ]|
|Resolution||Fixed [ 1 ]|
|Status||Open [ 1 ]||Patch Available [ 10002 ]|