[Devel] potential memory leak in sl module

Andrew Newton andy.newton at sunrocket.com
Thu Jan 11 19:57:01 CET 2007


All,

We believe we may have stumbled upon a possible memory leak in the sl  
module.  We observed the bug in SER 0.8.14, and started looking at  
newer code in both SER and OpenSER to see if it had been fixed.   
Though the code has changed in OpenSER, it looks like the bug still  
exists.

The potential leak is in sl_funcs.c, around line 217 (going off the  
current CVS HEAD).

   214 	ret = msg_send( msg->rcv.bind_address, msg->rcv.proto, &to,
   215 			msg->rcv.proto_reserved1, buf.s, buf.len);
   216 	mhomed=backup_mhomed;
   217 	if (ret<0)
   218 		goto error;
   219
   220 	*(sl_timeout) = get_ticks() + SL_RPL_WAIT_TIME;
   221 	pkg_free(buf.s);

Line 217 checks the output of the msg_send on line 214.  If there is  
an error, it bypasses the freeing of buf.s on line 221.  A possible  
fix might be to move line 221 to 216.

Can anybody confirm this analysis?

-andy



More information about the Devel mailing list