summaryrefslogtreecommitdiff
path: root/main/format.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-05-03 22:03:13 -0400
committerCorey Farrell <git@cfware.com>2015-05-03 22:08:14 -0400
commitf38066fcad559da3f214b4d309dcc4b070665d66 (patch)
treea697c461e5e35140a60c091718604ec8b7c37ca6 /main/format.c
parent92120247e99865d97a85461b08ba763e961e6232 (diff)
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
Diffstat (limited to 'main/format.c')
-rw-r--r--main/format.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main/format.c b/main/format.c
index 3e1ee866e..148c77f8d 100644
--- a/main/format.c
+++ b/main/format.c
@@ -36,6 +36,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#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 @@ int __ast_format_interface_register(const char *codec, const struct ast_format_i
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);