[asterisk-bugs] [Asterisk 0016574]: Memory leak on reload_config

Asterisk Bug Tracker noreply at bugs.digium.com
Sun Jan 10 21:57:49 CST 2010


The following issue has been SUBMITTED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16574 
====================================================================== 
Reported By:                ddv2005
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16574
Category:                   Addons/General
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Asterisk Version:           1.6.1.12 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-01-10 21:57 CST
Last Modified:              2010-01-10 21:57 CST
====================================================================== 
Summary:                    Memory leak on reload_config
Description: 
I found possible memory leak on reload_config in many modules (chan_sip as
well).
Source code look like:
==============================
        cfg = ast_config_load(config, config_flags);

        /* We *must* have a config file otherwise stop immediately */
        if (!cfg) {
                ast_log(LOG_NOTICE, "Unable to load config %s\n",
config);
                return -1;
        } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
                ucfg = ast_config_load("users.conf", config_flags);
                if (ucfg == CONFIG_STATUS_FILEUNCHANGED)
                        return 1;
                /* Must reread both files, because one changed */
                ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
                cfg = ast_config_load(config, config_flags);
        } else {
                ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
                ucfg = ast_config_load("users.conf", config_flags);
        }
==============================
The problem is that if (cfg == CONFIG_STATUS_FILEUNCHANGED) then cfg
pointer must be deallocated before exit or reload config. But no code to do
it.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-01-10 21:57 ddv2005        New Issue                                    
2010-01-10 21:57 ddv2005        Asterisk Version          => 1.6.1.12        
2010-01-10 21:57 ddv2005        Regression                => No              
2010-01-10 21:57 ddv2005        SVN Branch (only for SVN checkouts, not tarball
releases) => N/A             
======================================================================




More information about the asterisk-bugs mailing list