mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
use mm_ allocators
Signed-off-by: Kirill Rodriguez <theoden8@tutamail.com> Signed-off-by: Kirill Rodriguez <theoden8@gmail.com>
This commit is contained in:
parent
b6a3dc5ccc
commit
8572c273e9
6
evdns.c
6
evdns.c
@ -5383,9 +5383,9 @@ evdns_cache_write(struct evdns_base *dns_base, char *nodename, struct evutil_add
|
||||
log(EVDNS_LOG_DEBUG, "Ejecting old cache for %s", nodename);
|
||||
evdns_cache_free(cache);
|
||||
}
|
||||
cache = mm_malloc(sizeof(struct evdns_cache));
|
||||
cache = mm_calloc(1, sizeof(struct evdns_cache));
|
||||
cache->base = dns_base;
|
||||
cache->name = strdup(nodename);
|
||||
cache->name = mm_strdup(nodename);
|
||||
cache->ai = evutil_dup_addrinfo_(res);
|
||||
SPLAY_INSERT(evdns_tree, &cache->base->cache_root, cache);
|
||||
evtimer_assign(&cache->ev_timeout, dns_base->event_base, evdns_ttl_expired, cache);
|
||||
@ -5788,7 +5788,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
|
||||
data->user_cb = cb;
|
||||
data->user_data = arg;
|
||||
data->evdns_base = dns_base;
|
||||
data->nodename = strdup(nodename);
|
||||
data->nodename = mm_strdup(nodename);
|
||||
|
||||
want_cname = (hints.ai_flags & EVUTIL_AI_CANONNAME);
|
||||
|
||||
|
4
evutil.c
4
evutil.c
@ -1785,10 +1785,10 @@ evutil_dup_addrinfo_(struct evutil_addrinfo *ai)
|
||||
struct evutil_addrinfo *prev = NULL;
|
||||
for (; ai; ai = ai->ai_next) {
|
||||
int len = sizeof(struct evutil_addrinfo) + ai->ai_addrlen;
|
||||
struct evutil_addrinfo *n = calloc(1, len);
|
||||
struct evutil_addrinfo *n = mm_calloc(1, len);
|
||||
memcpy(n, ai, len);
|
||||
if (ai->ai_canonname) {
|
||||
n->ai_canonname = strdup(ai->ai_canonname);
|
||||
n->ai_canonname = mm_strdup(ai->ai_canonname);
|
||||
}
|
||||
n->ai_addr = (struct sockaddr*)(((char*)n) + sizeof(struct evutil_addrinfo));
|
||||
if (!first) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user