Skip to content

Commit abd4594

Browse files
committed
Fixed small issues missed in previous review
- new/free mismatch - style not fixed
1 parent b24b6ee commit abd4594

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ESP8266Interface.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int ESP8266Interface::connect()
6767
return NSAPI_ERROR_OK;
6868
}
6969

70-
nsapi_error_t ESP8266Interface::gethostbyname(const char* name, SocketAddress *address, nsapi_version_t version)
70+
nsapi_error_t ESP8266Interface::gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version)
7171
{
7272
if (address->set_ip_address(name)) {
7373
if (version != NSAPI_UNSPEC && address->get_ip_version() != version) {
@@ -77,16 +77,16 @@ nsapi_error_t ESP8266Interface::gethostbyname(const char* name, SocketAddress *a
7777
return NSAPI_ERROR_OK;
7878
}
7979

80-
char* ipbuff = new char[NSAPI_IP_SIZE];
80+
char *ipbuff = new char[NSAPI_IP_SIZE];
8181
int ret = 0;
8282

8383
if(!_esp.dns_lookup(name, ipbuff)) {
8484
ret = NSAPI_ERROR_DEVICE_ERROR;
85-
}
86-
else {
85+
} else {
8786
address->set_ip_address(ipbuff);
8887
}
89-
free(ipbuff);
88+
89+
delete[] ipbuff;
9090
return ret;
9191
}
9292

ESP8266Interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ESP8266Interface : public NetworkStack, public WiFiInterface
7070
* version is chosen by the stack (defaults to NSAPI_UNSPEC)
7171
* @return 0 on success, negative error code on failure
7272
*/
73-
virtual nsapi_error_t gethostbyname(const char* name, SocketAddress *address, nsapi_version_t version);
73+
virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version);
7474

7575
/** Set the WiFi network credentials
7676
*

0 commit comments

Comments
 (0)