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
fa684ffb
Commit
fa684ffb
authored
7 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_pjsip_history: Fix multiple leaks on vector append failure."
parents
d83d96db
48e96aba
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_pjsip_history.c
+23
-7
23 additions, 7 deletions
res/res_pjsip_history.c
with
23 additions
and
7 deletions
res/res_pjsip_history.c
+
23
−
7
View file @
fa684ffb
...
@@ -705,10 +705,13 @@ static pj_status_t history_on_tx_msg(pjsip_tx_data *tdata)
...
@@ -705,10 +705,13 @@ static pj_status_t history_on_tx_msg(pjsip_tx_data *tdata)
pj_sockaddr_cp
(
&
entry
->
dst
,
&
tdata
->
tp_info
.
dst_addr
);
pj_sockaddr_cp
(
&
entry
->
dst
,
&
tdata
->
tp_info
.
dst_addr
);
ast_mutex_lock
(
&
history_lock
);
ast_mutex_lock
(
&
history_lock
);
AST_VECTOR_APPEND
(
&
vector_history
,
entry
);
if
(
AST_VECTOR_APPEND
(
&
vector_history
,
entry
))
{
ao2_ref
(
entry
,
-
1
);
entry
=
NULL
;
}
ast_mutex_unlock
(
&
history_lock
);
ast_mutex_unlock
(
&
history_lock
);
if
(
log_level
!=
-
1
)
{
if
(
log_level
!=
-
1
&&
entry
)
{
char
line
[
256
];
char
line
[
256
];
sprint_list_entry
(
entry
,
line
,
sizeof
(
line
));
sprint_list_entry
(
entry
,
line
,
sizeof
(
line
));
...
@@ -745,10 +748,13 @@ static pj_bool_t history_on_rx_msg(pjsip_rx_data *rdata)
...
@@ -745,10 +748,13 @@ static pj_bool_t history_on_rx_msg(pjsip_rx_data *rdata)
}
}
ast_mutex_lock
(
&
history_lock
);
ast_mutex_lock
(
&
history_lock
);
AST_VECTOR_APPEND
(
&
vector_history
,
entry
);
if
(
AST_VECTOR_APPEND
(
&
vector_history
,
entry
))
{
ao2_ref
(
entry
,
-
1
);
entry
=
NULL
;
}
ast_mutex_unlock
(
&
history_lock
);
ast_mutex_unlock
(
&
history_lock
);
if
(
log_level
!=
-
1
)
{
if
(
log_level
!=
-
1
&&
entry
)
{
char
line
[
256
];
char
line
[
256
];
sprint_list_entry
(
entry
,
line
,
sizeof
(
line
));
sprint_list_entry
(
entry
,
line
,
sizeof
(
line
));
...
@@ -959,7 +965,9 @@ static int evaluate_history_entry(struct pjsip_history_entry *entry, struct expr
...
@@ -959,7 +965,9 @@ static int evaluate_history_entry(struct pjsip_history_entry *entry, struct expr
/* If this is not an operator, push it to the stack */
/* If this is not an operator, push it to the stack */
if
(
!
it_queue
->
op
)
{
if
(
!
it_queue
->
op
)
{
AST_VECTOR_APPEND
(
&
stack
,
it_queue
);
if
(
AST_VECTOR_APPEND
(
&
stack
,
it_queue
))
{
goto
error
;
}
continue
;
continue
;
}
}
...
@@ -1035,7 +1043,11 @@ static int evaluate_history_entry(struct pjsip_history_entry *entry, struct expr
...
@@ -1035,7 +1043,11 @@ static int evaluate_history_entry(struct pjsip_history_entry *entry, struct expr
if
(
!
result
)
{
if
(
!
result
)
{
goto
error
;
goto
error
;
}
}
AST_VECTOR_APPEND
(
&
stack
,
result
);
if
(
AST_VECTOR_APPEND
(
&
stack
,
result
))
{
expression_token_free
(
result
);
goto
error
;
}
}
}
/*
/*
...
@@ -1056,6 +1068,7 @@ static int evaluate_history_entry(struct pjsip_history_entry *entry, struct expr
...
@@ -1056,6 +1068,7 @@ static int evaluate_history_entry(struct pjsip_history_entry *entry, struct expr
}
}
result
=
final
->
result
;
result
=
final
->
result
;
ast_free
(
final
);
ast_free
(
final
);
AST_VECTOR_FREE
(
&
stack
);
return
result
;
return
result
;
...
@@ -1098,6 +1111,7 @@ static struct vector_history_t *filter_history(struct ast_cli_args *a)
...
@@ -1098,6 +1111,7 @@ static struct vector_history_t *filter_history(struct ast_cli_args *a)
queue
=
build_expression_queue
(
a
);
queue
=
build_expression_queue
(
a
);
if
(
!
queue
)
{
if
(
!
queue
)
{
AST_VECTOR_PTR_FREE
(
output
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1118,7 +1132,9 @@ static struct vector_history_t *filter_history(struct ast_cli_args *a)
...
@@ -1118,7 +1132,9 @@ static struct vector_history_t *filter_history(struct ast_cli_args *a)
}
else
if
(
!
res
)
{
}
else
if
(
!
res
)
{
continue
;
continue
;
}
else
{
}
else
{
AST_VECTOR_APPEND
(
output
,
ao2_bump
(
entry
));
if
(
AST_VECTOR_APPEND
(
output
,
ao2_bump
(
entry
)))
{
ao2_cleanup
(
entry
);
}
}
}
}
}
ast_mutex_unlock
(
&
history_lock
);
ast_mutex_unlock
(
&
history_lock
);
...
...
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