[Home]

Summary:ASTERISK-07598: [patch] Bugfixes for handling of channel variables
Reporter:Tony Mountifield (softins)Labels:
Date Opened:2006-08-24 14:19:55Date Closed:2006-08-24 14:54:09
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) channel.c.diff
( 1) linkedlists.h.diff
( 2) pbx.c.diff
Description:While debugging a problem with channel variables, I discovered the following bugs in certain actions on channel variables.

a) The function clone_variables() in channel.c does not use the correct linked list macro to remove the GROUP variables. Being within a "safe" traversal loop, it should use AST_LIST_REMOVE_CURRENT instead of AST_LIST_REMOVE.

b) Also within clone_variables(), the use of AST_LIST_INSERT_TAIL to append a whole list from the clone channel to the original channel leaves the tail pointer pointing at the first appended variable instead of the last This could cause variable loss or memory leaks.  I fixed it by defining a new macro AST_LIST_APPEND_LIST() to append a whole list to another list.

c) The function pbx_builtin_serialize_variables() stops traversing the list if it finds a variable with an empty value (which should be legal). This function is called by app_dumpchan and was causing the list of channel variables to be truncated. Also, the if-test of "variables" within the loop is unnecessary, because the same test is made in the for-statement itself.

Three patch files are attached, all against the latest 1.2 branch:

linkedlists.h.diff - definition of AST_LIST_APPEND_LIST()
channel.c.diff - corrections to clone_variables()
pbx.c.diff - correction to pbx_builtin_serialize_variables()

I haven't had time to check whether trunk has the same issues, but would suspect it does.
Comments:By: Russell Bryant (russell) 2006-08-24 14:54:09

fixed in 1.2 and the trunk in revisions 40994 and 40995.  Thanks, nice job!!!