[svn-commits] mmichelson: branch 10 r377842 - in /branches/10: ./ res/res_clialiases.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 11 14:48:20 CST 2012


Author: mmichelson
Date: Tue Dec 11 14:48:16 2012
New Revision: 377842

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=377842
Log:
Fix crash that can occur if CLI registration fails for an aliased command.

A recent memory leak fix in main/cli.c causes an ast_cli_entry's command
field to be freed and NULLed if ast_cli_register() fails. res_clialiases
was ignoring the return value of ast_cli_register() and was then passing
the NULL command off to a a hash function. This resulted in a crash.

The fix is not to ignore the erroneous return value. If ast_cli_register()
fails, then we do not continue trying to process the current alias.
........

Merged revisions 377840 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/10/   (props changed)
    branches/10/res/res_clialiases.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/res/res_clialiases.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/res/res_clialiases.c?view=diff&rev=377842&r1=377841&r2=377842
==============================================================================
--- branches/10/res/res_clialiases.c (original)
+++ branches/10/res/res_clialiases.c Tue Dec 11 14:48:16 2012
@@ -209,7 +209,10 @@
 			alias->cli_entry.command = alias->alias;
 			alias->cli_entry.usage = "Aliased CLI Command\n";
 
-			ast_cli_register(&alias->cli_entry);
+			if (ast_cli_register(&alias->cli_entry)) {
+				ao2_ref(alias, -1);
+				continue;
+			}
 			ao2_link(cli_aliases, alias);
 			ast_verbose(VERBOSE_PREFIX_2 "Aliased CLI command '%s' to '%s'\n", v1->name, v1->value);
 			ao2_ref(alias, -1);




More information about the svn-commits mailing list