Hi,
this is not meant as an intensive review on memory allocations in the PCU code. While browsing the code of the ready-to-send method to select the next payload I noticed the code below:
RlcMacDownlink_t * mac_control_block = (RlcMacDownlink_t *)malloc(sizeof(RlcMacDownlink_t)); LOGP(DRLCMAC, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Paging Request +++++++++++++++++++++++++\n"); decode_gsm_rlcmac_downlink(pag_vec, mac_control_block); LOGPC(DCSN1, LOGL_NOTICE, "\n"); LOGP(DRLCMAC, LOGL_DEBUG, "------------------------- TX : Packet Paging Request -------------------------\n"); bitvec_free(pag_vec);
This and other all other places really should use talloc to make finding memory leaks more easy (e.g. by printing the leak report), the second part is that we appear to leak this on every paging message sent by the PCU and the third is actually a question. Should we use a GCC extension that helps dealing with local variables? GCC can call a cleanup function on exit of the scope, an example can be seen here[1] nad this[2] is the description of the feature.
holger
[1] https://mail.gnome.org/archives/gtk-devel-list/2011-November/msg00050.html [2] http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html#Variable-Attribut...