Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
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
Libraries
UERANSIM
Commits
7376f37e
Commit
7376f37e
authored
Dec 24, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NTS memory leak fix
parent
4146a48a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
src/gnb/gtp/proto.cpp
src/gnb/gtp/proto.cpp
+12
-11
No files found.
src/gnb/gtp/proto.cpp
View file @
7376f37e
...
@@ -98,17 +98,17 @@ bool EncodeGtpMessage(const GtpMessage >p, OctetString &stream)
...
@@ -98,17 +98,17 @@ bool EncodeGtpMessage(const GtpMessage >p, OctetString &stream)
return
true
;
// success
return
true
;
// success
}
}
static
UdpPortExtHeader
*
DecodeUdpPortExtHeader
(
int
len
,
const
OctetView
&
stream
)
static
std
::
unique_ptr
<
UdpPortExtHeader
>
DecodeUdpPortExtHeader
(
int
len
,
const
OctetView
&
stream
)
{
{
if
(
len
!=
1
)
if
(
len
!=
1
)
return
nullptr
;
// length must be 1 for UdpPortExtHeader
return
nullptr
;
// length must be 1 for UdpPortExtHeader
auto
*
res
=
new
UdpPortExtHeader
();
auto
res
=
std
::
make_unique
<
UdpPortExtHeader
>
();
res
->
port
=
stream
.
read2US
();
res
->
port
=
stream
.
read2US
();
return
res
;
return
res
;
}
}
static
LongPdcpPduNumberExtHeader
*
DecodeLongPdcpPduNumberExtHeader
(
int
len
,
const
OctetView
&
stream
)
static
std
::
unique_ptr
<
LongPdcpPduNumberExtHeader
>
DecodeLongPdcpPduNumberExtHeader
(
int
len
,
const
OctetView
&
stream
)
{
{
if
(
len
!=
2
)
if
(
len
!=
2
)
return
nullptr
;
// length must be 2 for LongPdcpPduNumberExtHeader
return
nullptr
;
// length must be 2 for LongPdcpPduNumberExtHeader
...
@@ -119,12 +119,12 @@ static LongPdcpPduNumberExtHeader *DecodeLongPdcpPduNumberExtHeader(int len, con
...
@@ -119,12 +119,12 @@ static LongPdcpPduNumberExtHeader *DecodeLongPdcpPduNumberExtHeader(int len, con
num
<<=
8
;
num
<<=
8
;
num
|=
stream
.
readI
();
num
|=
stream
.
readI
();
auto
*
res
=
new
LongPdcpPduNumberExtHeader
();
auto
res
=
std
::
make_unique
<
LongPdcpPduNumberExtHeader
>
();
res
->
pdcpPduNumber
=
num
;
res
->
pdcpPduNumber
=
num
;
return
res
;
return
res
;
}
}
static
NrRanContainerExtHeader
*
DecodeNrRanContainerExtHeader
(
int
len
,
const
OctetView
&
stream
)
static
std
::
unique_ptr
<
NrRanContainerExtHeader
>
DecodeNrRanContainerExtHeader
(
int
len
,
const
OctetView
&
stream
)
{
{
// obtain actual length in octets. (but not used)
// obtain actual length in octets. (but not used)
len
=
4
*
len
-
2
;
len
=
4
*
len
-
2
;
...
@@ -133,22 +133,23 @@ static NrRanContainerExtHeader *DecodeNrRanContainerExtHeader(int len, const Oct
...
@@ -133,22 +133,23 @@ static NrRanContainerExtHeader *DecodeNrRanContainerExtHeader(int len, const Oct
return
nullptr
;
return
nullptr
;
}
}
static
PduSessionContainerExtHeader
*
DecodePduSessionContainerExtHeader
(
int
len
,
const
OctetView
&
stream
)
static
std
::
unique_ptr
<
PduSessionContainerExtHeader
>
DecodePduSessionContainerExtHeader
(
int
len
,
const
OctetView
&
stream
)
{
{
// obtain actual length in octets. (but not used)
// obtain actual length in octets. (but not used)
len
=
4
*
len
-
2
;
len
=
4
*
len
-
2
;
auto
*
res
=
new
PduSessionContainerExtHeader
();
auto
res
=
std
::
make_unique
<
PduSessionContainerExtHeader
>
();
res
->
pduSessionInformation
=
PduSessionInformation
::
Decode
(
stream
);
res
->
pduSessionInformation
=
PduSessionInformation
::
Decode
(
stream
);
return
res
;
return
res
;
}
}
static
PdcpPduNumberExtHeader
*
DecodePdcpPduNumberExtHeader
(
int
len
,
const
OctetView
&
stream
)
static
std
::
unique_ptr
<
PdcpPduNumberExtHeader
>
DecodePdcpPduNumberExtHeader
(
int
len
,
const
OctetView
&
stream
)
{
{
if
(
len
!=
1
)
if
(
len
!=
1
)
return
nullptr
;
// length must be 1 for PdcpPduNumberExtHeader
return
nullptr
;
// length must be 1 for PdcpPduNumberExtHeader
auto
*
res
=
new
PdcpPduNumberExtHeader
();
auto
res
=
std
::
make_unique
<
PdcpPduNumberExtHeader
>
();
res
->
pdcpPduNumber
=
stream
.
read2US
();
res
->
pdcpPduNumber
=
stream
.
read2US
();
return
res
;
return
res
;
}
}
...
@@ -199,7 +200,7 @@ std::unique_ptr<GtpMessage> DecodeGtpMessage(const OctetView &stream)
...
@@ -199,7 +200,7 @@ std::unique_ptr<GtpMessage> DecodeGtpMessage(const OctetView &stream)
{
{
int
len
=
stream
.
readI
();
// NOTE: len is actually 4 times length
int
len
=
stream
.
readI
();
// NOTE: len is actually 4 times length
GtpExtHeader
*
header
=
nullptr
;
std
::
unique_ptr
<
GtpExtHeader
>
header
=
nullptr
;
switch
(
nextExtHeaderType
)
switch
(
nextExtHeaderType
)
{
{
...
@@ -227,7 +228,7 @@ std::unique_ptr<GtpMessage> DecodeGtpMessage(const OctetView &stream)
...
@@ -227,7 +228,7 @@ std::unique_ptr<GtpMessage> DecodeGtpMessage(const OctetView &stream)
}
}
if
(
header
!=
nullptr
)
if
(
header
!=
nullptr
)
res
->
extHeaders
.
push_back
(
std
::
unique_ptr
<
GtpExtHeader
>
(
header
));
res
->
extHeaders
.
push_back
(
std
::
move
(
header
));
nextExtHeaderType
=
stream
.
readI
();
nextExtHeaderType
=
stream
.
readI
();
}
}
...
...
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