Summary:ASTERISK-07740: ast_config that holds variables from voicemail txt file is destroyed too early in advanced_options()
Reporter:Michael Neuhauser (mneuhauser)Labels:
Date Opened:2006-09-13 11:02:36Date Closed:2006-09-13 14:55:18
Versions:Frequency of
Environment:Attachments:( 0) adv-opt-destroy-cfg-later.patch
Description:Function advanced_options() loads the voicemail txt file into an ast_config structure. ast_variable_retrieve() is called for various values (e.g., callerid) and the returned values are stored in pointers (which point to the value part of the ast_variable structure). Then, before the main work is done, ast_config_destroy() is called. This frees the memory of all ast_variables and all the aforementioned pointers now point to already freed memory.

Solution: call ast_config_destroy(msg_cfg) not so early but just before returning from advanced_options().
Comments:By: Serge Vecher (serge-v) 2006-09-13 12:33:56

since you know how to fix it, can you please attach a patch?

By: Michael Neuhauser (mneuhauser) 2006-09-13 14:01:44

Patch uploaded. I just wasn't sure if it exceeds the limit for trivial patches, i.e., those where no disclaimer is needed.

By: Serge Vecher (serge-v) 2006-09-13 14:10:34

hmm, looks like a duplicate of 7618 here, not sure why that commit was not done for 1.2.x as well...

By: Tilghman Lesher (tilghman) 2006-09-13 14:55:18

Committed in 42892.

As to the disclaimer:  since this patch is a mirror of the patch (and yes, I compared them: only minor differences in the selection of lines) already applied in the fix for 7918 (to trunk), it does not contain enough expressive elements to be considered copyrightable by a separate entity.