mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
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
This commit is contained in:
@@ -36,6 +36,7 @@ ASTERISK_REGISTER_FILE()
|
||||
#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);
|
||||
|
||||
|
Reference in New Issue
Block a user