sntp: free the pbuf after sending the request

Fixes a memory leak.
This commit is contained in:
iosen 2016-06-21 23:16:10 +10:00
parent 26dd3f1c79
commit 37180024f4

View file

@ -608,6 +608,8 @@ sntp_send_request(ip_addr_t *server_addr)
sntp_initialize_request(sntpmsg); sntp_initialize_request(sntpmsg);
/* send request */ /* send request */
udp_sendto(sntp_pcb, p, server_addr, SNTP_PORT); udp_sendto(sntp_pcb, p, server_addr, SNTP_PORT);
pbuf_free(p);
/* set up receive timeout: try next server or retry on timeout */ /* set up receive timeout: try next server or retry on timeout */
sys_timeout((u32_t)SNTP_RECV_TIMEOUT, sntp_try_next_server, NULL); sys_timeout((u32_t)SNTP_RECV_TIMEOUT, sntp_try_next_server, NULL);
#if SNTP_CHECK_RESPONSE >= 1 #if SNTP_CHECK_RESPONSE >= 1