[Asterisk-code-review] Format Interfaces: Prevent unload except by shutdown. (asterisk[master])

Matt Jordan asteriskteam at digium.com
Mon May 4 09:25:43 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: Format Interfaces: Prevent unload except by shutdown.
......................................................................


Format Interfaces: Prevent unload except by shutdown.

Format interfaces cannot be unregistered, so the modules that provide them
need to be held open except by shutdown.

ASTERISK-25054 #close
Reported by: Corey Farrell

Change-Id: Iadbd9675bf0d30b8fded5a739b163db3ea2db8f3
---
M main/format.c
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/main/format.c b/main/format.c
index 8fed71f..bbfb697 100644
--- a/main/format.c
+++ b/main/format.c
@@ -36,6 +36,7 @@
 #include "asterisk/format.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/strings.h"
+#include "asterisk/module.h"
 
 /*! \brief Number of buckets to use for format interfaces (should be prime for performance reasons) */
 #define FORMAT_INTERFACE_BUCKETS 53
@@ -156,6 +157,8 @@
 	format_interface->interface = interface;
 	strcpy(format_interface->codec, codec); /* Safe */
 
+	/* Once registered a format interface cannot be unregistered. */
+	ast_module_shutdown_ref(mod);
 	ao2_link_flags(interfaces, format_interface, OBJ_NOLOCK);
 	ao2_ref(format_interface, -1);
 

-- 
To view, visit https://gerrit.asterisk.org/352
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iadbd9675bf0d30b8fded5a739b163db3ea2db8f3
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list