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
d91d0e99
Commit
d91d0e99
authored
7 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_stasis: Fix multiple leaks."
parents
0129e396
801094da
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
res/stasis/app.c
+7
-2
7 additions, 2 deletions
res/stasis/app.c
res/stasis/messaging.c
+10
-2
10 additions, 2 deletions
res/stasis/messaging.c
with
17 additions
and
4 deletions
res/stasis/app.c
+
7
−
2
View file @
d91d0e99
...
...
@@ -588,6 +588,7 @@ static int message_received_handler(const char *endpoint_id, struct ast_json *js
{
RAII_VAR
(
struct
ast_endpoint_snapshot
*
,
snapshot
,
NULL
,
ao2_cleanup
);
struct
ast_json
*
json_endpoint
;
struct
ast_json
*
message
;
struct
stasis_app
*
app
=
pvt
;
char
*
tech
;
char
*
resource
;
...
...
@@ -613,11 +614,15 @@ static int message_received_handler(const char *endpoint_id, struct ast_json *js
return
-
1
;
}
app_send
(
app
,
ast_json_pack
(
"{s: s, s: o, s: o, s: o}"
,
message
=
ast_json_pack
(
"{s: s, s: o, s: o, s: o}"
,
"type"
,
"TextMessageReceived"
,
"timestamp"
,
ast_json_timeval
(
ast_tvnow
(),
NULL
),
"endpoint"
,
json_endpoint
,
"message"
,
ast_json_ref
(
json_msg
)));
"message"
,
ast_json_ref
(
json_msg
));
if
(
message
)
{
app_send
(
app
,
message
);
ast_json_unref
(
message
);
}
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
res/stasis/messaging.c
+
10
−
2
View file @
d91d0e99
...
...
@@ -457,7 +457,11 @@ static struct message_subscription *get_or_create_subscription(struct ast_endpoi
ao2_link
(
endpoint_subscriptions
,
sub
);
}
else
{
ast_rwlock_wrlock
(
&
tech_subscriptions_lock
);
AST_VECTOR_APPEND
(
&
tech_subscriptions
,
ao2_bump
(
sub
));
if
(
AST_VECTOR_APPEND
(
&
tech_subscriptions
,
ao2_bump
(
sub
)))
{
/* Release the ao2_bump that was for the vector and allocation references. */
ao2_ref
(
sub
,
-
2
);
sub
=
NULL
;
}
ast_rwlock_unlock
(
&
tech_subscriptions_lock
);
}
...
...
@@ -485,7 +489,11 @@ int messaging_app_subscribe_endpoint(const char *app_name, struct ast_endpoint *
ao2_unlock
(
sub
);
return
-
1
;
}
AST_VECTOR_APPEND
(
&
sub
->
applications
,
tuple
);
if
(
AST_VECTOR_APPEND
(
&
sub
->
applications
,
tuple
))
{
ao2_ref
(
tuple
,
-
1
);
ao2_unlock
(
sub
);
return
-
1
;
}
ao2_unlock
(
sub
);
ast_debug
(
3
,
"App '%s' subscribed to messages from endpoint '%s'
\n
"
,
app_name
,
endpoint
?
ast_endpoint_get_id
(
endpoint
)
:
"-- ALL --"
);
...
...
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