Skip to content

Commit 8301bc6

Browse files
committed
free / malloc from upstream
1 parent e658551 commit 8301bc6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libraries/WiFi/src/WiFiUdp.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ uint8_t WiFiUDP::begin(IPAddress address, uint16_t port){
4444

4545
server_port = port;
4646

47-
tx_buffer = new char[1460];
47+
tx_buffer = (char *)malloc(1460);
4848
if(!tx_buffer){
4949
log_e("could not create tx buffer: %d", errno);
5050
return 0;
@@ -146,7 +146,7 @@ uint8_t WiFiUDP::beginMulticast(IPAddress a, uint16_t p){
146146

147147
void WiFiUDP::stop(){
148148
if(tx_buffer){
149-
delete[] tx_buffer;
149+
free(tx_buffer);
150150
tx_buffer = NULL;
151151
}
152152
tx_buffer_len = 0;
@@ -200,7 +200,7 @@ int WiFiUDP::beginPacket(){
200200

201201
// allocate tx_buffer if is necessary
202202
if(!tx_buffer){
203-
tx_buffer = new char[1460];
203+
tx_buffer = (char *)malloc(1460);
204204
if(!tx_buffer){
205205
log_e("could not create tx buffer: %d", errno);
206206
return 0;
@@ -257,6 +257,7 @@ int WiFiUDP::endPacket(){
257257
recipient.sin6_addr = *(in6_addr*)(ip_addr_t*)remote_ip;
258258
recipient.sin6_family = AF_INET6;
259259
recipient.sin6_port = htons(remote_port);
260+
recipient.sin6_scope_id = 0;
260261
int sent = sendto(udp_server, tx_buffer, tx_buffer_len, 0, (struct sockaddr*) &recipient, sizeof(recipient));
261262
if(sent < 0){
262263
log_e("could not send data: %d", errno);

0 commit comments

Comments
 (0)