diff options
author | Corey Farrell <git@cfware.com> | 2017-12-29 15:50:12 -0500 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2017-12-29 16:16:11 -0500 |
commit | 0fe7df641aa0e23b8400d32b935de4834ee4f182 (patch) | |
tree | 74e162d10c8b00645d2da5b9b62b1f629c7eeee9 /funcs | |
parent | 80e6b2eff54a4ff57e2521164224b1b1c878ae94 (diff) |
datastore: Add automatic module references.
Add a reference to the calling module when it is active to protect
access to datastore->info. Remove module references done by
func_periodic_hook as the datastore now handles it.
ASTERISK-25128 #close
Change-Id: I8357a3711e77591d0d1dd8ab4211a7eedd782c89
Diffstat (limited to 'funcs')
-rw-r--r-- | funcs/func_periodic_hook.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/funcs/func_periodic_hook.c b/funcs/func_periodic_hook.c index 0ab3d6b8b..958da9728 100644 --- a/funcs/func_periodic_hook.c +++ b/funcs/func_periodic_hook.c @@ -137,8 +137,6 @@ static void hook_datastore_destroy_callback(void *data) ast_free(state->context); ast_free(state->exten); ast_free(state); - - ast_module_unref(ast_module_info->self); } static const struct ast_datastore_info hook_datastore = { @@ -305,7 +303,7 @@ static int init_hook(struct ast_channel *chan, const char *context, const char * if (!(datastore = ast_datastore_alloc(&hook_datastore, uid))) { return -1; } - ast_module_ref(ast_module_info->self); + if (!(state = hook_state_alloc(context, exten, interval, hook_id))) { ast_datastore_free(datastore); return -1; |