Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
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
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Worker.N
openairinterface5G
Commits
b75500ac
Commit
b75500ac
authored
5 years ago
by
DONG Anyuan
Browse files
Options
Downloads
Patches
Plain Diff
Fix Coverity Scan CID 341066 (Using freed pointer ue_report.)
parent
04732d3a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openair2/ENB_APP/flexran_agent_handler.c
+45
-47
45 additions, 47 deletions
openair2/ENB_APP/flexran_agent_handler.c
with
45 additions
and
47 deletions
openair2/ENB_APP/flexran_agent_handler.c
+
45
−
47
View file @
b75500ac
...
@@ -423,19 +423,21 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
...
@@ -423,19 +423,21 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
int
flexran_agent_stats_reply
(
mid_t
enb_id
,
xid_t
xid
,
const
report_config_t
*
report_config
,
Protocol__FlexranMessage
**
msg
){
int
flexran_agent_stats_reply
(
mid_t
enb_id
,
xid_t
xid
,
const
report_config_t
*
report_config
,
Protocol__FlexranMessage
**
msg
){
Protocol__FlexHeader
*
header
=
NULL
;
Protocol__FlexHeader
*
header
=
NULL
;
Protocol__FlexUeStatsReport
**
ue_report
=
NULL
;
Protocol__FlexCellStatsReport
**
cell_report
=
NULL
;
Protocol__FlexStatsReply
*
stats_reply_msg
=
NULL
;
err_code_t
err_code
=
PROTOCOL__FLEXRAN_ERR__UNEXPECTED
;
err_code_t
err_code
=
PROTOCOL__FLEXRAN_ERR__UNEXPECTED
;
int
i
,
j
;
int
i
,
j
;
if
(
flexran_create_header
(
xid
,
PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY
,
&
header
)
!=
0
)
if
(
flexran_create_header
(
xid
,
PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY
,
&
header
)
!=
0
)
{
goto
error
;
goto
error
;
}
Protocol__FlexStatsReply
*
stats_reply_msg
;
stats_reply_msg
=
malloc
(
sizeof
(
Protocol__FlexStatsReply
));
stats_reply_msg
=
malloc
(
sizeof
(
Protocol__FlexStatsReply
));
if
(
stats_reply_msg
==
NULL
)
if
(
stats_reply_msg
==
NULL
)
{
goto
error
;
goto
error
;
}
protocol__flex_stats_reply__init
(
stats_reply_msg
);
protocol__flex_stats_reply__init
(
stats_reply_msg
);
stats_reply_msg
->
header
=
header
;
stats_reply_msg
->
header
=
header
;
...
@@ -445,18 +447,18 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -445,18 +447,18 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
// UE report
// UE report
Protocol__FlexUeStatsReport
**
ue_report
=
NULL
;
ue_report
=
malloc
(
sizeof
(
Protocol__FlexUeStatsReport
*
)
*
report_config
->
nr_ue
);
ue_report
=
malloc
(
sizeof
(
Protocol__FlexUeStatsReport
*
)
*
report_config
->
nr_ue
);
if
(
ue_report
==
NULL
)
{
free
(
stats_reply_msg
);
if
(
ue_report
==
NULL
)
{
goto
error
;
goto
error
;
}
}
for
(
i
=
0
;
i
<
report_config
->
nr_ue
;
i
++
)
{
for
(
i
=
0
;
i
<
report_config
->
nr_ue
;
i
++
)
{
ue_report
[
i
]
=
malloc
(
sizeof
(
Protocol__FlexUeStatsReport
));
ue_report
[
i
]
=
malloc
(
sizeof
(
Protocol__FlexUeStatsReport
));
if
(
ue_report
[
i
]
==
NULL
)
{
goto
error
;
}
protocol__flex_ue_stats_report__init
(
ue_report
[
i
]);
protocol__flex_ue_stats_report__init
(
ue_report
[
i
]);
ue_report
[
i
]
->
rnti
=
report_config
->
ue_report_type
[
i
].
ue_rnti
;
ue_report
[
i
]
->
rnti
=
report_config
->
ue_report_type
[
i
].
ue_rnti
;
ue_report
[
i
]
->
has_rnti
=
1
;
ue_report
[
i
]
->
has_rnti
=
1
;
...
@@ -465,17 +467,9 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -465,17 +467,9 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
}
}
// cell rpoert
// cell rpoert
Protocol__FlexCellStatsReport
**
cell_report
;
cell_report
=
malloc
(
sizeof
(
Protocol__FlexCellStatsReport
*
)
*
report_config
->
nr_cc
);
cell_report
=
malloc
(
sizeof
(
Protocol__FlexCellStatsReport
*
)
*
report_config
->
nr_cc
);
if
(
cell_report
==
NULL
)
{
if
(
cell_report
==
NULL
)
{
for
(
j
=
0
;
j
<
report_config
->
nr_ue
;
j
++
)
{
free
(
ue_report
[
j
]);
}
free
(
ue_report
);
free
(
stats_reply_msg
);
goto
error
;
goto
error
;
}
}
...
@@ -483,11 +477,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -483,11 +477,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
cell_report
[
i
]
=
malloc
(
sizeof
(
Protocol__FlexCellStatsReport
));
cell_report
[
i
]
=
malloc
(
sizeof
(
Protocol__FlexCellStatsReport
));
if
(
cell_report
[
i
]
==
NULL
)
{
if
(
cell_report
[
i
]
==
NULL
)
{
for
(
j
=
0
;
j
<
report_config
->
nr_ue
;
j
++
)
{
free
(
ue_report
[
j
]);
}
free
(
ue_report
);
free
(
stats_reply_msg
);
goto
error
;
goto
error
;
}
}
...
@@ -502,11 +491,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -502,11 +491,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
if
(
flexran_agent_get_mac_xface
(
enb_id
)
if
(
flexran_agent_get_mac_xface
(
enb_id
)
&&
flexran_agent_mac_stats_reply
(
enb_id
,
report_config
,
ue_report
,
cell_report
)
<
0
)
{
&&
flexran_agent_mac_stats_reply
(
enb_id
,
report_config
,
ue_report
,
cell_report
)
<
0
)
{
err_code
=
PROTOCOL__FLEXRAN_ERR__MSG_BUILD
;
err_code
=
PROTOCOL__FLEXRAN_ERR__MSG_BUILD
;
for
(
j
=
0
;
j
<
report_config
->
nr_ue
;
j
++
)
{
free
(
ue_report
[
j
]);
}
free
(
ue_report
);
free
(
stats_reply_msg
);
goto
error
;
goto
error
;
}
}
...
@@ -514,11 +498,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -514,11 +498,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
if
(
flexran_agent_get_rrc_xface
(
enb_id
)
if
(
flexran_agent_get_rrc_xface
(
enb_id
)
&&
flexran_agent_rrc_stats_reply
(
enb_id
,
report_config
,
ue_report
,
cell_report
)
<
0
)
{
&&
flexran_agent_rrc_stats_reply
(
enb_id
,
report_config
,
ue_report
,
cell_report
)
<
0
)
{
err_code
=
PROTOCOL__FLEXRAN_ERR__MSG_BUILD
;
err_code
=
PROTOCOL__FLEXRAN_ERR__MSG_BUILD
;
for
(
j
=
0
;
j
<
report_config
->
nr_ue
;
j
++
)
{
free
(
ue_report
[
j
]);
}
free
(
ue_report
);
free
(
stats_reply_msg
);
goto
error
;
goto
error
;
}
}
...
@@ -526,11 +505,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -526,11 +505,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
if
(
flexran_agent_get_pdcp_xface
(
enb_id
)
if
(
flexran_agent_get_pdcp_xface
(
enb_id
)
&&
flexran_agent_pdcp_stats_reply
(
enb_id
,
report_config
,
ue_report
,
cell_report
)
<
0
)
{
&&
flexran_agent_pdcp_stats_reply
(
enb_id
,
report_config
,
ue_report
,
cell_report
)
<
0
)
{
err_code
=
PROTOCOL__FLEXRAN_ERR__MSG_BUILD
;
err_code
=
PROTOCOL__FLEXRAN_ERR__MSG_BUILD
;
for
(
j
=
0
;
j
<
report_config
->
nr_ue
;
j
++
)
{
free
(
ue_report
[
j
]);
}
free
(
ue_report
);
free
(
stats_reply_msg
);
goto
error
;
goto
error
;
}
}
...
@@ -540,11 +514,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -540,11 +514,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
*
msg
=
malloc
(
sizeof
(
Protocol__FlexranMessage
));
*
msg
=
malloc
(
sizeof
(
Protocol__FlexranMessage
));
if
(
*
msg
==
NULL
)
{
if
(
*
msg
==
NULL
)
{
for
(
j
=
0
;
j
<
report_config
->
nr_ue
;
j
++
)
{
free
(
ue_report
[
j
]);
}
free
(
ue_report
);
free
(
stats_reply_msg
);
goto
error
;
goto
error
;
}
}
protocol__flexran_message__init
(
*
msg
);
protocol__flexran_message__init
(
*
msg
);
...
@@ -556,11 +525,40 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -556,11 +525,40 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
error
:
error
:
LOG_E
(
FLEXRAN_AGENT
,
"errno %d occured
\n
"
,
err_code
);
LOG_E
(
FLEXRAN_AGENT
,
"errno %d occured
\n
"
,
err_code
);
if
(
header
){
if
(
header
!=
NULL
)
{
free
(
header
);
free
(
header
);
header
=
NULL
;
}
}
return
err_code
;
if
(
stats_reply_msg
!=
NULL
)
{
free
(
stats_reply_msg
);
stats_reply_msg
=
NULL
;
}
if
(
ue_report
!=
NULL
)
{
for
(
j
=
0
;
j
<
report_config
->
nr_ue
;
j
++
)
{
if
(
ue_report
[
j
]
!=
NULL
)
{
free
(
ue_report
[
j
]);
ue_report
[
j
]
=
NULL
;
}
}
free
(
ue_report
);
ue_report
=
NULL
;
}
if
(
cell_report
!=
NULL
)
{
for
(
j
=
0
;
j
<
report_config
->
nr_cc
;
j
++
)
{
if
(
cell_report
[
j
]
!=
NULL
)
{
free
(
cell_report
[
j
]);
cell_report
[
j
]
=
NULL
;
}
}
free
(
cell_report
);
cell_report
=
NULL
;
}
return
err_code
;
}
}
/*
/*
...
...
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