diff options
author | Pavel Březina <pbrezina@redhat.com> | 2015-11-10 12:34:11 +0100 |
---|---|---|
committer | Lukas Slebodnik <lslebodn@redhat.com> | 2015-12-15 16:27:11 +0100 |
commit | 556801ec367543a8d534e55ecd11a977642bcee6 (patch) | |
tree | 5cfd9efb3adba446ece1ac2cbc8c64aa8ba1b58c /src/providers/ldap/sdap_sudo.c | |
parent | c0000a8cc9eccdf5cd8dd72fd6e9bc09d8c7cf00 (diff) | |
download | sssd-556801ec367543a8d534e55ecd11a977642bcee6.tar.gz sssd-556801ec367543a8d534e55ecd11a977642bcee6.tar.xz sssd-556801ec367543a8d534e55ecd11a977642bcee6.zip |
SUDO: fix potential memory leak in sdap_sudo_init
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/providers/ldap/sdap_sudo.c')
-rw-r--r-- | src/providers/ldap/sdap_sudo.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c index 97c71b745..ed4ecc674 100644 --- a/src/providers/ldap/sdap_sudo.c +++ b/src/providers/ldap/sdap_sudo.c @@ -76,7 +76,7 @@ int sdap_sudo_init(struct be_ctx *be_ctx, if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, "Cannot get SUDO options [%d]: %s\n", ret, strerror(ret)); - return ret; + goto done; } req = sdap_sudo_get_hostinfo_send(sudo_ctx, id_ctx->opts, be_ctx); @@ -98,7 +98,14 @@ int sdap_sudo_init(struct be_ctx *be_ctx, tevent_req_set_callback(req, sdap_sudo_get_hostinfo_done, sudo_ctx); } - return EOK; + ret = EOK; + +done: + if (ret != EOK) { + talloc_free(sudo_ctx); + } + + return ret; } static void sdap_sudo_get_hostinfo_done(struct tevent_req *req) |