Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
4a450f86
Commit
4a450f86
authored
10 years ago
by
Matt Jordan
Committed by
Gerrit Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fix potential crash after unload of func_periodic_hook or test_message." into 13
parents
f9114179
6b7282ca
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
funcs/func_periodic_hook.c
+2
-8
2 additions, 8 deletions
funcs/func_periodic_hook.c
tests/test_message.c
+2
-7
2 additions, 7 deletions
tests/test_message.c
with
4 additions
and
15 deletions
funcs/func_periodic_hook.c
+
2
−
8
View file @
4a450f86
...
@@ -446,13 +446,9 @@ static struct ast_custom_function hook_function = {
...
@@ -446,13 +446,9 @@ static struct ast_custom_function hook_function = {
.
write
=
hook_write
,
.
write
=
hook_write
,
};
};
static
struct
ast_context
*
func_periodic_hook_context
;
static
int
unload_module
(
void
)
static
int
unload_module
(
void
)
{
{
if
(
func_periodic_hook_context
)
{
ast_context_destroy
(
NULL
,
AST_MODULE
);
ast_context_destroy
(
func_periodic_hook_context
,
AST_MODULE
);
}
return
ast_custom_function_unregister
(
&
hook_function
);
return
ast_custom_function_unregister
(
&
hook_function
);
}
}
...
@@ -461,9 +457,7 @@ static int load_module(void)
...
@@ -461,9 +457,7 @@ static int load_module(void)
{
{
int
res
;
int
res
;
func_periodic_hook_context
=
ast_context_find_or_create
(
NULL
,
NULL
,
if
(
!
ast_context_find_or_create
(
NULL
,
NULL
,
context_name
,
AST_MODULE
))
{
context_name
,
AST_MODULE
);
if
(
!
func_periodic_hook_context
)
{
ast_log
(
LOG_ERROR
,
"Failed to create %s dialplan context.
\n
"
,
context_name
);
ast_log
(
LOG_ERROR
,
"Failed to create %s dialplan context.
\n
"
,
context_name
);
return
AST_MODULE_LOAD_DECLINE
;
return
AST_MODULE_LOAD_DECLINE
;
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/test_message.c
+
2
−
7
View file @
4a450f86
...
@@ -51,8 +51,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
...
@@ -51,8 +51,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
/*! \brief The number of user events we should get in a dialplan test */
/*! \brief The number of user events we should get in a dialplan test */
#define DEFAULT_EXPECTED_EVENTS 4
#define DEFAULT_EXPECTED_EVENTS 4
static
struct
ast_context
*
test_message_context
;
/*! \brief The current number of received user events */
/*! \brief The current number of received user events */
static
int
received_user_events
;
static
int
received_user_events
;
...
@@ -822,9 +820,7 @@ static int unload_module(void)
...
@@ -822,9 +820,7 @@ static int unload_module(void)
AST_TEST_UNREGISTER
(
test_message_has_destination_handler
);
AST_TEST_UNREGISTER
(
test_message_has_destination_handler
);
AST_TEST_UNREGISTER
(
test_message_msg_send
);
AST_TEST_UNREGISTER
(
test_message_msg_send
);
if
(
test_message_context
)
{
ast_context_destroy
(
NULL
,
AST_MODULE
);
ast_context_destroy
(
test_message_context
,
AST_MODULE
);
}
ast_manager_unregister_hook
(
&
user_event_hook
);
ast_manager_unregister_hook
(
&
user_event_hook
);
...
@@ -835,8 +831,7 @@ static int create_test_dialplan(void)
...
@@ -835,8 +831,7 @@ static int create_test_dialplan(void)
{
{
int
res
=
0
;
int
res
=
0
;
test_message_context
=
ast_context_find_or_create
(
NULL
,
NULL
,
TEST_CONTEXT
,
AST_MODULE
);
if
(
!
ast_context_find_or_create
(
NULL
,
NULL
,
TEST_CONTEXT
,
AST_MODULE
))
{
if
(
!
test_message_context
)
{
return
-
1
;
return
-
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment