Don't return stack pointers from functions (especially since the code will attempt to free() them later)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23854 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2006-05-01 03:58:13 +00:00
parent 205d0aa430
commit dfdf6e1f76

View File

@@ -930,7 +930,7 @@ static char *complete_ch_helper(const char *line, const char *word, int pos, int
c = ast_channel_walk_locked(c); c = ast_channel_walk_locked(c);
} }
if (c) { if (c) {
ret = ast_strdupa(c->name); ret = strdup(c->name);
ast_mutex_unlock(&c->lock); ast_mutex_unlock(&c->lock);
} else } else
ret = NULL; ret = NULL;
@@ -949,12 +949,12 @@ static char *complete_debug_port (const char *line, const char *word, int pos, i
switch (pos) { switch (pos) {
case 4: if (*word == 'p') case 4: if (*word == 'p')
return ast_strdupa("port"); return strdup("port");
else if (*word == 'o') else if (*word == 'o')
return ast_strdupa("only"); return strdup("only");
break; break;
case 6: if (*word == 'o') case 6: if (*word == 'o')
return ast_strdupa("only"); return strdup("only");
break; break;
} }
return NULL; return NULL;
@@ -1512,8 +1512,11 @@ static int read_config(struct chan_list *ch, int orig) {
ast_set_callerid(ast, bc->oad, NULL, bc->oad); ast_set_callerid(ast, bc->oad, NULL, bc->oad);
} }
if ( !ast_strlen_zero(bc->rad) ) if ( !ast_strlen_zero(bc->rad) ) {
ast->cid.cid_rdnis=ast_strdupa(bc->rad); if (ast->cid.cid_rdnis)
free(ast->cid.cid_rdnis);
ast->cid.cid_rdnis = strdup(bc->rad);
}
} }
return 0; return 0;
} }