Unverified Commit 44beee2f authored by Rodrigo Garcia's avatar Rodrigo Garcia Committed by GitHub

Fixes DNS Server Memory Leak when deleted (#6707)

parent 0b3f1a9f
...@@ -20,6 +20,22 @@ DNSServer::DNSServer() ...@@ -20,6 +20,22 @@ DNSServer::DNSServer()
_port = 0; _port = 0;
} }
DNSServer::~DNSServer()
{
if (_dnsHeader) {
free(_dnsHeader);
_dnsHeader = NULL;
}
if (_dnsQuestion) {
free(_dnsQuestion);
_dnsQuestion = NULL;
}
if (_buffer) {
free(_buffer);
_buffer = NULL;
}
}
bool DNSServer::start(const uint16_t &port, const String &domainName, bool DNSServer::start(const uint16_t &port, const String &domainName,
const IPAddress &resolvedIP) const IPAddress &resolvedIP)
{ {
......
...@@ -76,6 +76,7 @@ class DNSServer ...@@ -76,6 +76,7 @@ class DNSServer
{ {
public: public:
DNSServer(); DNSServer();
~DNSServer();
void processNextRequest(); void processNextRequest();
void setErrorReplyCode(const DNSReplyCode &replyCode); void setErrorReplyCode(const DNSReplyCode &replyCode);
void setTTL(const uint32_t &ttl); void setTTL(const uint32_t &ttl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment