various: cleanup issues found during leak hunt

In this collection of small patches to prevent
Valgrind errors are: fixes for reference leaks
in config hooks, evaluating a parameter beyond
bounds, and accessing a structure after a lock
where it could have been already free'd.

Review: https://reviewboard.asterisk.org/r/4407/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Scott Griepentrog
2015-02-06 21:26:12 +00:00
parent 18c8c1bae3
commit 323c0927ac
3 changed files with 9 additions and 2 deletions

View File

@@ -3821,6 +3821,9 @@ static void config_shutdown(void)
AST_LIST_UNLOCK(&cfmtime_head);
ast_cli_unregister_multiple(cli_config, ARRAY_LEN(cli_config));
ao2_cleanup(cfg_hooks);
cfg_hooks = NULL;
}
int register_config_cli(void)
@@ -3909,5 +3912,6 @@ int ast_config_hook_register(const char *name,
hook->module = ast_strdup(module);
ao2_link(cfg_hooks, hook);
ao2_ref(hook, -1);
return 0;
}

View File

@@ -1856,7 +1856,7 @@ void ast_join_delim(char *s, size_t len, const char * const w[], unsigned int si
/* Join words into a string */
if (!s)
return;
for (x = 0; ofs < len && w[x] && x < size; x++) {
for (x = 0; ofs < len && x < size && w[x] ; x++) {
if (x > 0)
s[ofs++] = delim;
for (src = w[x]; *src && ofs < len; src++)