Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
8134a421
Commit
8134a421
authored
Feb 16, 2021
by
me-no-dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix leak of memory and possible crashes in AsyncUDP
parent
f13ff656
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
libraries/AsyncUDP/src/AsyncUDP.cpp
libraries/AsyncUDP/src/AsyncUDP.cpp
+11
-2
libraries/AsyncUDP/src/AsyncUDP.h
libraries/AsyncUDP/src/AsyncUDP.h
+1
-0
No files found.
libraries/AsyncUDP/src/AsyncUDP.cpp
View file @
8134a421
...
...
@@ -277,6 +277,16 @@ void AsyncUDPMessage::flush()
_index
=
0
;
}
AsyncUDPPacket
::
AsyncUDPPacket
(
AsyncUDPPacket
&
packet
){
_udp
=
packet
.
_udp
;
_pb
=
packet
.
_pb
;
_if
=
packet
.
_if
;
_data
=
packet
.
_data
;
_len
=
packet
.
_len
;
_index
=
0
;
pbuf_ref
(
_pb
);
}
AsyncUDPPacket
::
AsyncUDPPacket
(
AsyncUDP
*
udp
,
pbuf
*
pb
,
const
ip_addr_t
*
raddr
,
uint16_t
rport
,
struct
netif
*
ntif
)
{
...
...
@@ -683,9 +693,8 @@ void AsyncUDP::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint16_t po
if
(
_handler
)
{
AsyncUDPPacket
packet
(
this
,
this_pb
,
addr
,
port
,
netif
);
_handler
(
packet
);
}
else
{
pbuf_free
(
this_pb
);
}
pbuf_free
(
this_pb
);
}
}
...
...
libraries/AsyncUDP/src/AsyncUDP.h
View file @
8134a421
...
...
@@ -58,6 +58,7 @@ protected:
size_t
_len
;
size_t
_index
;
public:
AsyncUDPPacket
(
AsyncUDPPacket
&
packet
);
AsyncUDPPacket
(
AsyncUDP
*
udp
,
pbuf
*
pb
,
const
ip_addr_t
*
addr
,
uint16_t
port
,
struct
netif
*
netif
);
virtual
~
AsyncUDPPacket
();
...
...
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