Skip to content

Commit

Permalink
Fix refcounts issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Sep 10, 2014
1 parent 459a2d8 commit ce7bb10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ rdns_process_timer (void *arg)
/* Select random IO channel */
req->io = serv->io_channels[ottery_rand_uint32 () % serv->io_cnt];
req->io->uses ++;
REF_RETAIN (req->io);
renew = true;
}

Expand Down Expand Up @@ -472,6 +473,8 @@ rdns_make_request_full (
req->arg = cbdata;
req->reply = NULL;
req->qcount = queries;
req->io = NULL;
req->state = RDNS_REQUEST_NEW;
req->requested_names = malloc (queries * sizeof (struct rdns_request_name));
if (req->requested_names == NULL) {
free (req);
Expand Down Expand Up @@ -740,6 +743,7 @@ rdns_resolver_free (struct rdns_resolver *resolver)
ioc = serv->io_channels[i];
REF_RELEASE (ioc);
}
serv->io_cnt = 0;
UPSTREAM_DEL (resolver->servers, serv);
free (serv->io_channels);
free (serv->name);
Expand Down
1 change: 0 additions & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ rdns_ioc_free (struct rdns_io_channel *ioc)
struct rdns_request *req, *rtmp;

HASH_ITER (hh, ioc->requests, req, rtmp) {
HASH_DELETE (hh, ioc->requests, req);
REF_RELEASE (req);
}
ioc->resolver->async->del_read (ioc->resolver->async->data,
Expand Down

0 comments on commit ce7bb10

Please sign in to comment.