From a991a6bc456c840bf7c2c292c5711c80002f5754 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 6 Nov 2009 18:20:26 -0500 Subject: Check return, zero free hostent, adhere to style --- server/providers/fail_over.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'server/providers') diff --git a/server/providers/fail_over.c b/server/providers/fail_over.c index ce94ac30..796fc900 100644 --- a/server/providers/fail_over.c +++ b/server/providers/fail_over.c @@ -456,16 +456,18 @@ fo_resolve_service_done(struct tevent_req *subreq) int resolv_status; struct resolve_service_request *request; struct server_common *common; + int ret; common = tevent_req_callback_data(subreq, struct server_common); - if (common->hostent != NULL) - talloc_free(common->hostent); - resolv_gethostbyname_recv(common, subreq, &resolv_status, NULL, - &common->hostent); - talloc_free(subreq); + if (common->hostent != NULL) { + talloc_zfree(common->hostent); + } - if (common->hostent == NULL) { + ret = resolv_gethostbyname_recv(subreq, common, + &resolv_status, NULL, &common->hostent); + talloc_free(subreq); + if (ret != EOK) { DEBUG(1, ("Failed to resolve %s: %s\n", common->name, resolv_strerror(resolv_status))); } @@ -473,10 +475,11 @@ fo_resolve_service_done(struct tevent_req *subreq) /* Take care of all requests for this server. */ while ((request = common->request_list) != NULL) { DLIST_REMOVE(common->request_list, request); - if (resolv_status) + if (resolv_status) { tevent_req_error(request->req, resolv_status); - else + } else { tevent_req_done(request->req); + } } } -- cgit