MemLeak: fix memory leak when cache size is 0

This commit is contained in:
Nick Peng
2021-01-24 11:12:35 +08:00
parent 3ba8c418f7
commit 51e1e6565f
3 changed files with 7 additions and 4 deletions

View File

@@ -298,6 +298,7 @@ int dns_cache_insert(char *domain, int ttl, dns_type_t qtype, int speed, struct
}
if (dns_cache_head.size <= 0) {
dns_cache_data_free(cache_data);
return 0;
}