Skip to content

Commit 26581eb

Browse files
committed
Style changes
1 parent 1240d82 commit 26581eb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ESP8266/ESP8266.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,14 @@ class ESP8266
116116
* see @a nsapi_error
117117
*/
118118
int scan(WiFiAccessPoint *res, unsigned limit);
119+
119120
/**Perform a dns query
120121
*
121122
* @param name Hostname to resolve
122123
* @param ip Buffer to store IP address
123124
* @return 0 true on success, false on failure
124125
*/
125-
bool dns_lookup(const char* name, char* ip);
126+
bool dns_lookup(const char *name, char *ip);
126127

127128
/**
128129
* Open a socketed connection

ESP8266Interface.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,13 @@ nsapi_error_t ESP8266Interface::gethostbyname(const char* name, SocketAddress *a
7777
return NSAPI_ERROR_OK;
7878
}
7979

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

83-
if(!_esp.dns_lookup(name, ipbuff))
84-
{
83+
if(!_esp.dns_lookup(name, ipbuff)) {
8584
ret = NSAPI_ERROR_DEVICE_ERROR;
8685
}
87-
else{
86+
else {
8887
address->set_ip_address(ipbuff);
8988
}
9089
free(ipbuff);

0 commit comments

Comments
 (0)