From 37180024f48c80371d271384103ce4267746070a Mon Sep 17 00:00:00 2001 From: iosen Date: Tue, 21 Jun 2016 23:16:10 +1000 Subject: [PATCH] sntp: free the pbuf after sending the request Fixes a memory leak. --- extras/sntp/sntp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/sntp/sntp.c b/extras/sntp/sntp.c index 5654075..48b2f14 100644 --- a/extras/sntp/sntp.c +++ b/extras/sntp/sntp.c @@ -608,6 +608,8 @@ sntp_send_request(ip_addr_t *server_addr) sntp_initialize_request(sntpmsg); /* send request */ udp_sendto(sntp_pcb, p, server_addr, SNTP_PORT); + pbuf_free(p); + /* set up receive timeout: try next server or retry on timeout */ sys_timeout((u32_t)SNTP_RECV_TIMEOUT, sntp_try_next_server, NULL); #if SNTP_CHECK_RESPONSE >= 1