Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
b21b3e08
Commit
b21b3e08
authored
Jul 17, 2016
by
Arnim Läuger
Committed by
Marcel Stör
Jul 17, 2016
Browse files
Free HTTP headers and post data memory in disconnect and DNS failure callback (#1403)
parent
cc2fee5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/http/httpclient.c
View file @
b21b3e08
...
...
@@ -233,6 +233,22 @@ static void ICACHE_FLASH_ATTR http_connect_callback( void * arg )
HTTPCLIENT_DEBUG
(
"Sending request header
\n
"
);
}
static
void
http_free_req
(
request_args_t
*
req
)
{
if
(
req
->
buffer
)
{
os_free
(
req
->
buffer
);
}
if
(
req
->
post_data
)
{
os_free
(
req
->
post_data
);
}
if
(
req
->
headers
)
{
os_free
(
req
->
headers
);
}
os_free
(
req
->
hostname
);
os_free
(
req
->
method
);
os_free
(
req
->
path
);
os_free
(
req
);
}
static
void
ICACHE_FLASH_ATTR
http_disconnect_callback
(
void
*
arg
)
{
...
...
@@ -301,13 +317,7 @@ static void ICACHE_FLASH_ATTR http_disconnect_callback( void * arg )
{
req
->
callback_handle
(
body
,
http_status
,
req
->
buffer
);
}
if
(
req
->
buffer
)
{
os_free
(
req
->
buffer
);
}
os_free
(
req
->
hostname
);
os_free
(
req
->
method
);
os_free
(
req
->
path
);
os_free
(
req
);
http_free_req
(
req
);
}
/* Fix memory leak. */
espconn_delete
(
conn
);
...
...
@@ -354,7 +364,7 @@ static void ICACHE_FLASH_ATTR http_dns_callback( const char * hostname, ip_addr_
{
req
->
callback_handle
(
""
,
-
1
,
""
);
}
os
_free
(
req
);
http
_free
_req
(
req
);
}
else
{
...
...
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