Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
b75500ac
Commit
b75500ac
authored
May 31, 2019
by
Dong Anyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Coverity Scan CID 341066 (Using freed pointer ue_report.)
parent
04732d3a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
47 deletions
+45
-47
openair2/ENB_APP/flexran_agent_handler.c
openair2/ENB_APP/flexran_agent_handler.c
+45
-47
No files found.
openair2/ENB_APP/flexran_agent_handler.c
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
)
{
if
(
ue_report
==
NULL
)
{
free
(
stats_reply_msg
);
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
;
...
@@ -466,16 +468,8 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
...
@@ -466,16 +468,8 @@ 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
;
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment