We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c842977 commit 52fc349Copy full SHA for 52fc349
libraries/WiFi/src/WiFiUdp.cpp
@@ -7,10 +7,10 @@ extern WiFiClass WiFi;
7
#endif
8
9
arduino::WiFiUDP::WiFiUDP() {
10
- _packet_buffer = (uint8_t*)malloc(WIFI_UDP_BUFFER_SIZE);
+ _packet_buffer = new uint8_t[WIFI_UDP_BUFFER_SIZE];
11
_current_packet = NULL;
12
_current_packet_size = 0;
13
- // if this malloc fails then ::begin will fail
+ // if this allocation fails then ::begin will fail
14
}
15
16
uint8_t arduino::WiFiUDP::begin(uint16_t port) {
@@ -33,6 +33,7 @@ uint8_t arduino::WiFiUDP::begin(uint16_t port) {
33
34
void arduino::WiFiUDP::stop() {
35
_socket.close();
36
+ delete[] _packet_buffer;
37
38
39
int arduino::WiFiUDP::beginPacket(IPAddress ip, uint16_t port) {
0 commit comments