summaryrefslogtreecommitdiff
path: root/funcs/func_periodic_hook.c
diff options
context:
space:
mode:
Diffstat (limited to 'funcs/func_periodic_hook.c')
-rw-r--r--funcs/func_periodic_hook.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/funcs/func_periodic_hook.c b/funcs/func_periodic_hook.c
index d40e420f7..1f6f3aea9 100644
--- a/funcs/func_periodic_hook.c
+++ b/funcs/func_periodic_hook.c
@@ -135,6 +135,8 @@ 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 = {
@@ -298,10 +300,13 @@ static int init_hook(struct ast_channel *chan, const char *context, const char *
snprintf(uid, sizeof(uid), "%u", hook_id);
+ ast_module_ref(ast_module_info->self);
if (!(datastore = ast_datastore_alloc(&hook_datastore, uid))) {
+ ast_module_unref(ast_module_info->self);
return -1;
}
if (!(state = hook_state_alloc(context, exten, interval, hook_id))) {
+ ast_module_unref(ast_module_info->self);
ast_datastore_free(datastore);
return -1;
}