Summary: | ASTERISK-04475: [patch] ast_recvchar() ast_recvtext() fix memory leak and bug | ||
Reporter: | Luigi Rizzo (rizzo) | Labels: | |
Date Opened: | 2005-06-23 15:30:00 | Date Closed: | 2008-01-15 15:39:20.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) chan1.diff | |
Description: | The two functions have similar bugs: - ast_recvtext() will leak a frame if it receives a HANGUP frame, or the malloc fails. - ast_recvchar() will leak a frame if it receives a HANGUP frame, and will misinterpret chars >= 0x80 as errors. This patch fixes both issues, and implements ast_recvchar() as a wrapper around ast_recvtext(). The performance implications (an extra strdup that could be saved) are very limited and the function is used only once in res_agi so it is certainly not on the critical path of some heavily used loop. In return we remove a relatively long and duplicated piece of code. | ||
Comments: | By: Kevin P. Fleming (kpfleming) 2005-06-23 17:27:48 Committed to CVS HEAD, thanks! By: Digium Subversion (svnbot) 2008-01-15 15:39:20.000-0600 Repository: asterisk Revision: 5989 U trunk/channel.c ------------------------------------------------------------------------ r5989 | kpfleming | 2008-01-15 15:39:19 -0600 (Tue, 15 Jan 2008) | 2 lines optimize ast_recvchar/ast_recvtext (bug ASTERISK-4475) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=5989 |