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
885a029a
Commit
885a029a
authored
Aug 21, 2023
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leaks in do_NR_DLInformationTransfer()
parent
a4c75620
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
43 deletions
+41
-43
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+28
-33
openair2/RRC/NR/MESSAGES/asn1_msg.h
openair2/RRC/NR/MESSAGES/asn1_msg.h
+6
-8
openair2/RRC/NR/rrc_gNB_NGAP.c
openair2/RRC/NR/rrc_gNB_NGAP.c
+7
-2
No files found.
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
885a029a
...
...
@@ -948,41 +948,36 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
}
//------------------------------------------------------------------------------
uint8_t
do_NR_DLInformationTransfer
(
uint8_t
Mod_id
,
uint8_t
**
buffer
,
uint8_t
do_NR_DLInformationTransfer
(
uint8_t
Mod_id
,
uint8_t
*
buffer
,
size_t
buffer_len
,
uint8_t
transaction_id
,
uint32_t
pdu_length
,
uint8_t
*
pdu_buffer
)
uint8_t
*
pdu_buffer
)
//------------------------------------------------------------------------------
{
ssize_t
encoded
;
NR_DL_DCCH_Message_t
dl_dcch_msg
=
{
0
};
NR_DL_DCCH_Message_t
dl_dcch_msg
=
{
0
};
dl_dcch_msg
.
message
.
present
=
NR_DL_DCCH_MessageType_PR_c1
;
asn1cCalloc
(
dl_dcch_msg
.
message
.
choice
.
c1
,
c1
);
c1
->
present
=
NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer
;
asn1cCalloc
(
c1
->
choice
.
dlInformationTransfer
,
infoTransfer
);
infoTransfer
->
rrc_TransactionIdentifier
=
transaction_id
;
infoTransfer
->
criticalExtensions
.
present
=
NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer
;
infoTransfer
->
criticalExtensions
.
present
=
NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer
;
asn1cCalloc
(
infoTransfer
->
criticalExtensions
.
choice
.
dlInformationTransfer
,
dlInfoTransfer
);
asn1cCalloc
(
dlInfoTransfer
->
dedicatedNAS_Message
,
msg
);
asn1cCalloc
(
dlInfoTransfer
->
dedicatedNAS_Message
,
msg
);
// we will free the caller buffer, that is ok in the present code logic (else it will leak memory) but not natural,
// comprehensive code design
msg
->
buf
=
pdu_buffer
;
msg
->
size
=
pdu_length
;
encoded
=
uper_encode_to_new_buffer
(
&
asn_DEF_NR_DL_DCCH_Message
,
NULL
,
(
void
*
)
&
dl_dcch_msg
,
(
void
**
)
buffer
);
AssertFatal
(
encoded
>
0
,
"ASN1 message encoding failed (%s, %ld)!
\n
"
,
"DLInformationTransfer"
,
encoded
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_NR_DL_DCCH_Message
,
&
dl_dcch_msg
);
LOG_D
(
NR_RRC
,
"DLInformationTransfer Encoded %zd bytes
\n
"
,
encoded
);
//for (int i=0;i<encoded;i++) printf("%02x ",(*buffer)[i]);
return
encoded
;
asn_enc_rval_t
r
=
uper_encode_to_buffer
(
&
asn_DEF_NR_DL_DCCH_Message
,
NULL
,
(
void
*
)
&
dl_dcch_msg
,
buffer
,
buffer_len
);
AssertFatal
(
r
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %ld)!
\n
"
,
"DLInformationTransfer"
,
r
.
encoded
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_NR_DL_DCCH_Message
,
&
dl_dcch_msg
);
LOG_D
(
NR_RRC
,
"DLInformationTransfer Encoded %zd bytes
\n
"
,
r
.
encoded
);
// for (int i=0;i<encoded;i++) printf("%02x ",(*buffer)[i]);
return
r
.
encoded
;
}
uint8_t
do_NR_ULInformationTransfer
(
uint8_t
**
buffer
,
uint32_t
pdu_length
,
uint8_t
*
pdu_buffer
)
{
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.h
View file @
885a029a
...
...
@@ -128,14 +128,12 @@ uint8_t do_NR_RRCReconfigurationComplete(
const
uint8_t
Transaction_id
);
uint8_t
do_NR_DLInformationTransfer
(
uint8_t
Mod_id
,
uint8_t
**
buffer
,
uint8_t
do_NR_DLInformationTransfer
(
uint8_t
Mod_id
,
uint8_t
*
buffer
,
size_t
buffer_len
,
uint8_t
transaction_id
,
uint32_t
pdu_length
,
uint8_t
*
pdu_buffer
);
uint8_t
*
pdu_buffer
);
uint8_t
do_NR_ULInformationTransfer
(
uint8_t
**
buffer
,
uint32_t
pdu_length
,
...
...
openair2/RRC/NR/rrc_gNB_NGAP.c
View file @
885a029a
...
...
@@ -588,7 +588,7 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu
//------------------------------------------------------------------------------
{
uint32_t
length
;
uint8_t
*
buffer
;
uint8_t
buffer
[
4096
]
;
protocol_ctxt_t
ctxt
=
{
0
};
ngap_downlink_nas_t
*
req
=
&
NGAP_DOWNLINK_NAS
(
msg_p
);
rrc_gNB_ue_context_t
*
ue_context_p
=
rrc_gNB_get_ue_context
(
RC
.
nrrrc
[
instance
],
req
->
gNB_ue_ngap_id
);
...
...
@@ -611,7 +611,12 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu
PROTOCOL_CTXT_SET_BY_INSTANCE
(
&
ctxt
,
instance
,
GNB_FLAG_YES
,
UE
->
rrc_ue_id
,
0
,
0
);
/* Create message for PDCP (DLInformationTransfer_t) */
length
=
do_NR_DLInformationTransfer
(
instance
,
&
buffer
,
rrc_gNB_get_next_transaction_identifier
(
instance
),
req
->
nas_pdu
.
length
,
req
->
nas_pdu
.
buffer
);
length
=
do_NR_DLInformationTransfer
(
instance
,
buffer
,
sizeof
(
buffer
),
rrc_gNB_get_next_transaction_identifier
(
instance
),
req
->
nas_pdu
.
length
,
req
->
nas_pdu
.
buffer
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,
buffer
,
length
,
"[MSG] RRC DL Information Transfer
\n
"
);
/*
* switch UL or DL NAS message without RRC piggybacked to SRB2 if active.
...
...
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