According to evdns.c, the result not freed by libevent after
the callback runs:
evdns_getaddrinfo_gotresolve()
{
...
data->user_cb(0, data->pending_result, data->user_data);
data->pending_result = NULL;
...
}
To reproduce, build with -fsanitize=address, add -g to the getopt
list in dns-example.c like in the current commit and run
dns-example -g google.com
Closes: #681 # cherry-picked
{
const char *name = arg;
int i;
+ struct evutil_addrinfo *first_ai = ai;
+
if (err) {
printf("%s: %s\n", name, evutil_gai_strerror(err));
}
printf("[%d] %s: %s\n",i,name,buf);
}
}
+
+ if (first_ai)
+ evutil_freeaddrinfo(first_ai);
}
static void
return 1;
}
- while ((opt = getopt(c, v, "xvc:Ts:")) != -1) {
+ while ((opt = getopt(c, v, "xvc:Ts:g")) != -1) {
switch (opt) {
case 'x': o.reverse = 1; break;
case 'v': ++verbose; break;