android: Fix memory leaks in DNS proxy

Fixes: 2dc26c557e ("android: Add DNS proxy implementation")
This commit is contained in:
Tobias Brunner
2026-07-23 10:26:08 +02:00
parent 5e51fc7902
commit 67bf0051c4
@@ -175,6 +175,7 @@ CALLBACK(handle_response, bool,
} }
packet = ip_packet_create_udp_from_data(src, this->src, packet = ip_packet_create_udp_from_data(src, this->src,
chunk_create(buf, len)); chunk_create(buf, len));
src->destroy(src);
if (!packet) if (!packet)
{ {
DBG1(DBG_NET, "failed to parse DNS response"); DBG1(DBG_NET, "failed to parse DNS response");
@@ -349,6 +350,7 @@ METHOD(android_dns_proxy_t, handle, bool,
DBG1(DBG_NET, "sending DNS request failed: %s", strerror(errno)); DBG1(DBG_NET, "sending DNS request failed: %s", strerror(errno));
} }
this->lock->unlock(this->lock); this->lock->unlock(this->lock);
packet->destroy(packet);
return TRUE; return TRUE;
} }