summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_periodic_hook.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/funcs/func_periodic_hook.c b/funcs/func_periodic_hook.c
index 1f6f3aea9..661ebcbed 100644
--- a/funcs/func_periodic_hook.c
+++ b/funcs/func_periodic_hook.c
@@ -300,13 +300,11 @@ 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;
}
+ ast_module_ref(ast_module_info->self);
if (!(state = hook_state_alloc(context, exten, interval, hook_id))) {
- ast_module_unref(ast_module_info->self);
ast_datastore_free(datastore);
return -1;
}