summaryrefslogtreecommitdiffstats
path: root/server/providers/fail_over.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-11-06 18:20:26 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-11-09 10:53:49 -0500
commita991a6bc456c840bf7c2c292c5711c80002f5754 (patch)
tree8543011fa1d796829e13770d0174174f5aaffbc3 /server/providers/fail_over.c
parenta69766ff324dcd2c3543c6969e3f77c38c4dc629 (diff)
downloadsssd-a991a6bc456c840bf7c2c292c5711c80002f5754.tar.gz
sssd-a991a6bc456c840bf7c2c292c5711c80002f5754.tar.xz
sssd-a991a6bc456c840bf7c2c292c5711c80002f5754.zip
Check return, zero free hostent, adhere to style
Diffstat (limited to 'server/providers/fail_over.c')
-rw-r--r--server/providers/fail_over.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/server/providers/fail_over.c b/server/providers/fail_over.c
index ce94ac30f..796fc900a 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);
+ }
}
}