summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c5
-rw-r--r--main/optional_api.c20
2 files changed, 6 insertions, 19 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 395d0cc18..3b08d76c5 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -247,7 +247,6 @@ int daemon(int, int); /* defined in libresolv of all places */
#include "asterisk/stasis_endpoints.h"
#include "asterisk/stasis_system.h"
#include "asterisk/security_events.h"
-#include "asterisk/optional_api.h"
#include "../defaults.h"
@@ -4169,10 +4168,6 @@ int main(int argc, char *argv[])
ast_el_read_history(filename);
}
-#if defined(OPTIONAL_API)
- ast_register_cleanup(optional_api_cleanup);
-#endif
-
ast_json_init();
ast_ulaw_init();
ast_alaw_init();
diff --git a/main/optional_api.c b/main/optional_api.c
index f48fe11a1..9c96fa646 100644
--- a/main/optional_api.c
+++ b/main/optional_api.c
@@ -158,18 +158,8 @@ struct {
size_t len;
} apis;
-void optional_api_cleanup(void)
-{
- while (apis.len--) {
- optional_api_destroy(apis.list[apis.len]);
- }
- free(apis.list);
- apis.list = NULL;
- apis.maxlen = 0;
-}
-
/*!
- * \brief Gets (or creates) the \ref optional_api for the give function.
+ * \brief Gets (or creates) the \ref optional_api for the given function.
*
* \param sysname Name of the function to look up.
* \return Corresponding \ref optional_api.
@@ -181,9 +171,11 @@ static struct optional_api *get_api(const char *symname)
size_t i;
/* Find one, if we already have it */
- for (i = 0; i < apis.len; ++i) {
- if (strcmp(symname, apis.list[i]->symname) == 0) {
- return apis.list[i];
+ if (apis.list) {
+ for (i = 0; i < apis.len; ++i) {
+ if (strcmp(symname, apis.list[i]->symname) == 0) {
+ return apis.list[i];
+ }
}
}