mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
Remember the pointer to the allocated block of memory so that we can free it and not cause a memory leak. (issue #8449 reported by arkadia)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@48146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2058,7 +2058,8 @@ static int load_config(void)
|
||||
ast_unregister_features();
|
||||
var = ast_variable_browse(cfg, "applicationmap");
|
||||
while(var) {
|
||||
char *tmp_val=strdup(var->value);
|
||||
char *tmp_val_orig=strdup(var->value);
|
||||
char *tmp_val = tmp_val_orig;
|
||||
char *exten, *party=NULL, *app=NULL, *app_args=NULL;
|
||||
|
||||
if (!tmp_val) {
|
||||
@@ -2075,7 +2076,7 @@ static int load_config(void)
|
||||
|
||||
if (!(app && strlen(app)) || !(exten && strlen(exten)) || !(party && strlen(party)) || !(var->name && strlen(var->name))) {
|
||||
ast_log(LOG_NOTICE, "Please check the feature Mapping Syntax, either extension, name, or app aren't provided %s %s %s %s\n",app,exten,party,var->name);
|
||||
free(tmp_val);
|
||||
free(tmp_val_orig);
|
||||
var = var->next;
|
||||
continue;
|
||||
}
|
||||
@@ -2090,7 +2091,7 @@ static int load_config(void)
|
||||
}
|
||||
if (!feature) {
|
||||
ast_log(LOG_NOTICE, "Malloc failed at feature mapping\n");
|
||||
free(tmp_val);
|
||||
free(tmp_val_orig);
|
||||
var = var->next;
|
||||
continue;
|
||||
}
|
||||
@@ -2099,7 +2100,6 @@ static int load_config(void)
|
||||
ast_copy_string(feature->sname,var->name,FEATURE_SNAME_LEN);
|
||||
ast_copy_string(feature->app,app,FEATURE_APP_LEN);
|
||||
ast_copy_string(feature->exten, exten,FEATURE_EXTEN_LEN);
|
||||
free(tmp_val);
|
||||
|
||||
if (app_args)
|
||||
ast_copy_string(feature->app_args,app_args,FEATURE_APP_ARGS_LEN);
|
||||
@@ -2114,6 +2114,7 @@ static int load_config(void)
|
||||
ast_set_flag(feature,AST_FEATURE_FLAG_CALLEE);
|
||||
else {
|
||||
ast_log(LOG_NOTICE, "Invalid party specification for feature '%s', must be caller, or callee\n", var->name);
|
||||
free(tmp_val_orig);
|
||||
var = var->next;
|
||||
continue;
|
||||
}
|
||||
@@ -2121,6 +2122,7 @@ static int load_config(void)
|
||||
ast_register_feature(feature);
|
||||
|
||||
if (option_verbose >=1) ast_verbose(VERBOSE_PREFIX_2 "Mapping Feature '%s' to app '%s' with code '%s'\n", var->name, app, exten);
|
||||
free(tmp_val_orig);
|
||||
}
|
||||
var = var->next;
|
||||
}
|
||||
|
Reference in New Issue
Block a user