diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2012-02-13 08:57:23 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-02-13 11:54:53 -0500 |
commit | 50fcb0f65eea9bfb4906d55f5ea5f7e570379b1a (patch) | |
tree | c386a59018ef36e86b5c3b85f7f2080f1965f9e0 | |
parent | ae765daed93b64b9b4177466a2191561b6734e63 (diff) | |
download | sssd-50fcb0f65eea9bfb4906d55f5ea5f7e570379b1a.tar.gz sssd-50fcb0f65eea9bfb4906d55f5ea5f7e570379b1a.tar.bz2 sssd-50fcb0f65eea9bfb4906d55f5ea5f7e570379b1a.zip |
Fix bad failure handling in be_sudo_handler()
If the dbus_message_get_args() failed, we would have been
dereferencing a NULL be_req.
Coverity #12490
-rw-r--r-- | src/providers/data_provider_be.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 401b3a40..2cea1933 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -720,6 +720,19 @@ static int be_sudo_handler(DBusMessage *message, struct sbus_connection *conn) return ENOMEM; } + /* create be request */ + be_req = talloc_zero(be_cli, struct be_req); + if (be_req == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_zero failed.\n")); + dbus_message_unref(reply); + return ENOMEM; + } + + be_req->becli = be_cli; + be_req->be_ctx = be_cli->bectx; + be_req->pvt = reply; + be_req->fn = be_sudo_handler_callback; + /* get arguments */ dbus_error_init(&dbus_error); @@ -751,19 +764,6 @@ static int be_sudo_handler(DBusMessage *message, struct sbus_connection *conn) */ } - /* create be request */ - be_req = talloc_zero(be_cli, struct be_req); - if (be_req == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_zero failed.\n")); - dbus_message_unref(reply); - return ENOMEM; - } - - be_req->becli = be_cli; - be_req->be_ctx = be_cli->bectx; - be_req->pvt = reply; - be_req->fn = be_sudo_handler_callback; - /* get and set sudo request data */ sudo_req = talloc_zero(be_req, struct be_sudo_req); if (sudo_req == NULL) { |