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
ZhouShuya
OpenXG-RAN
Commits
14f3d6a7
Commit
14f3d6a7
authored
Mar 19, 2021
by
Thomas Schlichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gNB: fix memory allocations in fix_scc() and prepare_scd()
issues found by valgrind
parent
dade64ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
24 deletions
+16
-24
openair2/GNB_APP/gnb_config.c
openair2/GNB_APP/gnb_config.c
+16
-24
No files found.
openair2/GNB_APP/gnb_config.c
View file @
14f3d6a7
...
...
@@ -297,7 +297,7 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) {
void
prepare_scd
(
NR_ServingCellConfig_t
*
scd
)
{
// Allocate downlink structures
scd
->
downlinkBWP_ToAddModList
=
CALLOC
(
1
,
sizeof
(
scd
->
downlinkBWP_ToAddModList
));
scd
->
downlinkBWP_ToAddModList
=
CALLOC
(
1
,
sizeof
(
*
scd
->
downlinkBWP_ToAddModList
));
// Downlink bandwidth part
NR_BWP_Downlink_t
*
bwp
=
calloc
(
1
,
sizeof
(
*
bwp
));
...
...
@@ -318,29 +318,25 @@ void prepare_scd(NR_ServingCellConfig_t *scd) {
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
present
=
NR_SetupRelease_PTRS_DownlinkConfig_PR_setup
;
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
choice
.
setup
=
CALLOC
(
1
,
sizeof
(
*
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
choice
.
setup
));
NR_PTRS_DownlinkConfig_t
*
NR_PTRS_DownlinkCfg
=
NR_DMRS_DownlinkCfg
->
phaseTrackingRS
->
choice
.
setup
;
NR_PTRS_DownlinkCfg
->
frequencyDensity
=
CALLOC
(
1
,
sizeof
(
NR_PTRS_DownlinkCfg
->
frequencyDensity
));
int
*
dl_rbs
[
2
]
;
NR_PTRS_DownlinkCfg
->
frequencyDensity
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
frequencyDensity
));
long
*
dl_rbs
=
CALLOC
(
2
,
sizeof
(
long
))
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
dl_rbs
[
i
]
=
CALLOC
(
1
,
sizeof
(
*
dl_rbs
[
i
]));
*
dl_rbs
[
i
]
=
0
;
ASN_SEQUENCE_ADD
(
&
NR_PTRS_DownlinkCfg
->
frequencyDensity
->
list
,
dl_rbs
[
i
]);
ASN_SEQUENCE_ADD
(
&
NR_PTRS_DownlinkCfg
->
frequencyDensity
->
list
,
&
dl_rbs
[
i
]);
}
NR_PTRS_DownlinkCfg
->
timeDensity
=
CALLOC
(
1
,
sizeof
(
NR_PTRS_DownlinkCfg
->
timeDensity
));
int
*
dl_mcs
[
3
]
;
NR_PTRS_DownlinkCfg
->
timeDensity
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
timeDensity
));
long
*
dl_mcs
=
CALLOC
(
3
,
sizeof
(
long
))
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
dl_mcs
[
i
]
=
CALLOC
(
1
,
sizeof
(
*
dl_mcs
[
i
]));
*
dl_mcs
[
i
]
=
0
;
ASN_SEQUENCE_ADD
(
&
NR_PTRS_DownlinkCfg
->
timeDensity
->
list
,
dl_mcs
[
i
]);
ASN_SEQUENCE_ADD
(
&
NR_PTRS_DownlinkCfg
->
timeDensity
->
list
,
&
dl_mcs
[
i
]);
}
NR_PTRS_DownlinkCfg
->
epre_Ratio
=
CALLOC
(
1
,
sizeof
(
NR_PTRS_DownlinkCfg
->
epre_Ratio
));
NR_PTRS_DownlinkCfg
->
resourceElementOffset
=
CALLOC
(
1
,
sizeof
(
NR_PTRS_DownlinkCfg
->
resourceElementOffset
));
NR_PTRS_DownlinkCfg
->
epre_Ratio
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
epre_Ratio
));
NR_PTRS_DownlinkCfg
->
resourceElementOffset
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_DownlinkCfg
->
resourceElementOffset
));
*
NR_PTRS_DownlinkCfg
->
resourceElementOffset
=
0
;
ASN_SEQUENCE_ADD
(
&
scd
->
downlinkBWP_ToAddModList
->
list
,
bwp
);
// Allocate uplink structures
scd
->
uplinkConfig
=
CALLOC
(
1
,
sizeof
(
NR_UplinkConfig_t
));
scd
->
uplinkConfig
->
uplinkBWP_ToAddModList
=
CALLOC
(
1
,
sizeof
(
scd
->
uplinkConfig
->
uplinkBWP_ToAddModList
));
scd
->
uplinkConfig
=
CALLOC
(
1
,
sizeof
(
*
scd
->
uplinkConfig
));
scd
->
uplinkConfig
->
uplinkBWP_ToAddModList
=
CALLOC
(
1
,
sizeof
(
*
scd
->
uplinkConfig
->
uplinkBWP_ToAddModList
));
NR_PUSCH_Config_t
*
pusch_Config
=
CALLOC
(
1
,
sizeof
(
*
pusch_Config
));
...
...
@@ -355,20 +351,16 @@ void prepare_scd(NR_ServingCellConfig_t *scd) {
NR_PTRS_UplinkConfig_t
*
NR_PTRS_UplinkConfig
=
NR_DMRS_UplinkConfig
->
phaseTrackingRS
->
choice
.
setup
;
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
));
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
));
int
*
n_rbs
[
2
]
;
long
*
n_rbs
=
CALLOC
(
2
,
sizeof
(
long
))
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
n_rbs
[
i
]
=
CALLOC
(
1
,
sizeof
(
*
n_rbs
[
i
]));
*
n_rbs
[
i
]
=
0
;
ASN_SEQUENCE_ADD
(
&
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
->
list
,
n_rbs
[
i
]);
ASN_SEQUENCE_ADD
(
&
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
frequencyDensity
->
list
,
&
n_rbs
[
i
]);
}
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
));
int
*
ptrs_mcs
[
3
]
;
long
*
ptrs_mcs
=
CALLOC
(
3
,
sizeof
(
long
))
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
ptrs_mcs
[
i
]
=
CALLOC
(
1
,
sizeof
(
*
ptrs_mcs
[
i
]));
*
ptrs_mcs
[
i
]
=
0
;
ASN_SEQUENCE_ADD
(
&
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
->
list
,
ptrs_mcs
[
i
]);
ASN_SEQUENCE_ADD
(
&
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
timeDensity
->
list
,
&
ptrs_mcs
[
i
]);
}
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
=
CALLOC
(
1
,
sizeof
(
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
));
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
=
CALLOC
(
1
,
sizeof
(
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
));
*
NR_PTRS_UplinkConfig
->
transformPrecoderDisabled
->
resourceElementOffset
=
0
;
// UL bandwidth part
...
...
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