[asterisk-commits] rmudgett: branch 10 r377241 - /branches/10/main/format.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 4 20:09:16 CST 2012


Author: rmudgett
Date: Tue Dec  4 20:09:13 2012
New Revision: 377241

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=377241
Log:
* Fix registering core show codecs/codec CLI commands twice.

* Fix registering atexit format_attr_shutdown() more than once.

Modified:
    branches/10/main/format.c

Modified: branches/10/main/format.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/format.c?view=diff&rev=377241&r1=377240&r2=377241
==============================================================================
--- branches/10/main/format.c (original)
+++ branches/10/main/format.c Tue Dec  4 20:09:13 2012
@@ -881,7 +881,6 @@
 };
 int init_framer(void)
 {
-	ast_cli_register_multiple(my_clis, ARRAY_LEN(my_clis));
 	return 0;
 }
 
@@ -1083,30 +1082,27 @@
 /*! \internal \brief Clean up resources on Asterisk shutdown */
 static void format_attr_shutdown(void)
 {
+	ast_cli_unregister_multiple(my_clis, ARRAY_LEN(my_clis));
 	if (interfaces) {
 		ao2_ref(interfaces, -1);
 		interfaces = NULL;
 	}
+	ast_rwlock_destroy(&ilock);
 }
 
 int ast_format_attr_init(void)
 {
+	if (ast_rwlock_init(&ilock)) {
+		return -1;
+	}
+	if (!(interfaces = ao2_container_alloc(283, interface_hash_cb, interface_cmp_cb))) {
+		ast_rwlock_destroy(&ilock);
+		return -1;
+	}
+
 	ast_cli_register_multiple(my_clis, ARRAY_LEN(my_clis));
-	if (ast_rwlock_init(&ilock)) {
-		return -1;
-	}
-
-	if (!(interfaces = ao2_container_alloc(283, interface_hash_cb, interface_cmp_cb))) {
-		goto init_cleanup;
-	}
-	return 0;
-
-init_cleanup:
-	ast_rwlock_destroy(&ilock);
-	if (interfaces) {
-		ao2_ref(interfaces, -1);
-	}
-	return -1;
+	ast_register_atexit(format_attr_shutdown);
+	return 0;
 }
 
 static int custom_celt_format(struct ast_format_list *entry, unsigned int maxbitrate, unsigned int framesize)
@@ -1200,7 +1196,6 @@
 		*id = 0;
 		return -1;
 	}
-	ast_register_atexit(format_attr_shutdown);
 	return 0;
 }
 




More information about the asterisk-commits mailing list