diff options
author | Pavel Březina <pbrezina@redhat.com> | 2013-06-10 10:34:38 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-06-21 10:00:25 +0200 |
commit | b509de2164be8fa9a8d52d70883f4ec70b4bddf8 (patch) | |
tree | 8cc539eb304f221ba9683e51ec4ae080dc12922b /src/providers | |
parent | e0ade8d1e00d577686f893e0059def5866dcb9f6 (diff) | |
download | sssd-b509de2164be8fa9a8d52d70883f4ec70b4bddf8.tar.gz sssd-b509de2164be8fa9a8d52d70883f4ec70b4bddf8.tar.bz2 sssd-b509de2164be8fa9a8d52d70883f4ec70b4bddf8.zip |
failover: do not return invalid pointer when server is already present
https://fedorahosted.org/sssd/ticket/1947
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/fail_over.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c index 5704e73a..c4dd1ea0 100644 --- a/src/providers/fail_over.c +++ b/src/providers/fail_over.c @@ -733,6 +733,7 @@ static errno_t fo_add_server_list(struct fo_service *service, struct fo_server **_last_server) { struct fo_server *server = NULL; + struct fo_server *last_server = NULL; struct fo_server *srv_list = NULL; size_t i; errno_t ret; @@ -750,8 +751,11 @@ static errno_t fo_add_server_list(struct fo_service *service, ret = fo_add_server_to_list(&srv_list, service->server_list, server, service->name); if (ret != EOK) { - talloc_free(server); + talloc_zfree(server); + continue; } + + last_server = server; } if (srv_list != NULL) { @@ -760,7 +764,7 @@ static errno_t fo_add_server_list(struct fo_service *service, } if (_last_server != NULL) { - *_last_server = server; + *_last_server = last_server == NULL ? after_server : last_server; } return EOK; |