diff --git a/main/pbx.c b/main/pbx.c index 63cbd22..247f38c 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -5301,12 +5301,17 @@ int ast_context_remove_extension(const char *context, const char *extension, int int ast_context_remove_extension_callerid(const char *context, const char *extension, int priority, const char *callerid, int matchcallerid, const char *registrar) { int ret = -1; /* default error return */ - struct ast_context *c = find_context_locked(context); + struct ast_context *c; + + ao2_lock(hints); + c = find_context_locked(context); if (c) { /* ... remove extension ... */ ret = ast_context_remove_extension_callerid2(c, extension, priority, callerid, matchcallerid, registrar, 1); ast_unlock_contexts(); } + + ao2_unlock(hints); return ret; } @@ -7781,7 +7786,10 @@ int ast_add_extension(const char *context, int replace, const char *extension, const char *application, void *data, void (*datad)(void *), const char *registrar) { int ret = -1; - struct ast_context *c = find_context_locked(context); + struct ast_context *c; + + ao2_lock(hints); + c = find_context_locked(context); if (c) { ret = ast_add_extension2(c, replace, extension, priority, label, callerid, @@ -7789,6 +7797,7 @@ int ast_add_extension(const char *context, int replace, const char *extension, ast_unlock_contexts(); } + ao2_unlock(hints); return ret; }