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
94d93e4d
Commit
94d93e4d
authored
9 years ago
by
Matt Jordan
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_ari.c: Add missing off nominal unlock and remove a RAII_VAR()." into 13
parents
1a5e087e
c61547fe
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/res_ari.c
+11
-8
11 additions, 8 deletions
res/res_ari.c
with
11 additions
and
8 deletions
res/res_ari.c
+
11
−
8
View file @
94d93e4d
...
@@ -180,8 +180,7 @@ int ast_ari_add_handler(struct stasis_rest_handlers *handler)
...
@@ -180,8 +180,7 @@ int ast_ari_add_handler(struct stasis_rest_handlers *handler)
SCOPED_MUTEX
(
lock
,
&
root_handler_lock
);
SCOPED_MUTEX
(
lock
,
&
root_handler_lock
);
old_size
=
sizeof
(
*
new_handler
)
+
old_size
=
sizeof
(
*
new_handler
)
+
root_handler
->
num_children
*
sizeof
(
handler
);
root_handler
->
num_children
*
sizeof
(
handler
);
new_size
=
old_size
+
sizeof
(
handler
);
new_size
=
old_size
+
sizeof
(
handler
);
new_handler
=
ao2_alloc
(
new_size
,
NULL
);
new_handler
=
ao2_alloc
(
new_size
,
NULL
);
...
@@ -200,21 +199,24 @@ int ast_ari_add_handler(struct stasis_rest_handlers *handler)
...
@@ -200,21 +199,24 @@ int ast_ari_add_handler(struct stasis_rest_handlers *handler)
int
ast_ari_remove_handler
(
struct
stasis_rest_handlers
*
handler
)
int
ast_ari_remove_handler
(
struct
stasis_rest_handlers
*
handler
)
{
{
RAII_VAR
(
struct
stasis_rest_handlers
*
,
new_handler
,
NULL
,
ao2_cleanup
);
struct
stasis_rest_handlers
*
new_handler
;
size_t
size
,
i
,
j
;
size_t
size
;
size_t
i
;
size_t
j
;
ast_assert
(
root_handler
!=
NULL
);
ast_assert
(
root_handler
!=
NULL
);
ast_mutex_lock
(
&
root_handler_lock
);
ast_mutex_lock
(
&
root_handler_lock
);
size
=
sizeof
(
*
new_handler
)
+
size
=
sizeof
(
*
new_handler
)
+
root_handler
->
num_children
*
sizeof
(
handler
);
root_handler
->
num_children
*
sizeof
(
handler
);
new_handler
=
ao2_alloc
(
size
,
NULL
);
new_handler
=
ao2_alloc
(
size
,
NULL
);
if
(
!
new_handler
)
{
if
(
!
new_handler
)
{
ast_mutex_unlock
(
&
root_handler_lock
);
return
-
1
;
return
-
1
;
}
}
memcpy
(
new_handler
,
root_handler
,
sizeof
(
*
new_handler
));
/* Create replacement root_handler less the handler to remove. */
memcpy
(
new_handler
,
root_handler
,
sizeof
(
*
new_handler
));
for
(
i
=
0
,
j
=
0
;
i
<
root_handler
->
num_children
;
++
i
)
{
for
(
i
=
0
,
j
=
0
;
i
<
root_handler
->
num_children
;
++
i
)
{
if
(
root_handler
->
children
[
i
]
==
handler
)
{
if
(
root_handler
->
children
[
i
]
==
handler
)
{
ast_module_unref
(
ast_module_info
->
self
);
ast_module_unref
(
ast_module_info
->
self
);
...
@@ -224,9 +226,10 @@ int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
...
@@ -224,9 +226,10 @@ int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
}
}
new_handler
->
num_children
=
j
;
new_handler
->
num_children
=
j
;
/* Replace the old root_handler with the new. */
ao2_cleanup
(
root_handler
);
ao2_cleanup
(
root_handler
);
ao2_ref
(
new_handler
,
+
1
);
root_handler
=
new_handler
;
root_handler
=
new_handler
;
ast_mutex_unlock
(
&
root_handler_lock
);
ast_mutex_unlock
(
&
root_handler_lock
);
return
0
;
return
0
;
}
}
...
...
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