[Home]

Summary:ASTERISK-14828: Memory leak on reload_config
Reporter:Dmitry Dudkin (ddv2005)Labels:
Date Opened:2010-01-10 21:57:49.000-0600Date Closed:2010-01-10 23:30:56.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Addons/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
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.
Comments:By: Dmitry Dudkin (ddv2005) 2010-01-10 22:07:48.000-0600

Please close this issue. It is my fault.

By: snuffy (snuffy) 2010-01-10 23:30:55.000-0600

user requested close