On 03/12/2013 02:47 PM, Michal Židek wrote:
On 03/12/2013 01:07 PM, Ondrej Kos wrote:
diff --git a/src/providers/krb5/krb5_renew_tgt.c
b/src/providers/krb5/krb5_renew_tgt.c
index
e8957484286b34781f66d5dc43efdf4a3dab4530..f593edb506b4e207f6cdc786bf144fd04ea7f51c
100644
--- a/src/providers/krb5/krb5_renew_tgt.c
+++ b/src/providers/krb5/krb5_renew_tgt.c
@@ -157,7 +157,7 @@ static errno_t renew_all_tgts(struct renew_tgt_ctx
*renew_tgt_ctx)
time_t now;
struct auth_data *auth_data;
struct renew_data *renew_data;
- struct tevent_timer *te;
+ struct tevent_timer *te = NULL;
ret = hash_entries(renew_tgt_ctx->tgt_table, &count, &entries);
if (ret != HASH_SUCCESS) {
Could you remove the te = NULL; on line 200 in this file. It is not
needed if the variable is initialized.
Michal
Nice catch, new patch attached.
Ondra
--
Ondrej Kos
Associate Software Engineer
Identity Management
Red Hat Czech
phone: +420-532-294-558
cell: +420-736-417-909
ext: 82-62558
loc: 1013 Brno 1 office
irc: okos @ #sssd #brno
From 8d849076e29e28d046012f1e91fe18f642cd3ba0 Mon Sep 17 00:00:00 2001
From: Ondrej Kos <o...@redhat.com>
Date: Tue, 12 Mar 2013 13:05:09 +0100
Subject: [PATCH] Fix initialization of multiple variables
---
src/db/sysdb_search.c | 2 +-
src/providers/ipa/ipa_hbac_common.c | 2 +-
src/providers/ipa/ipa_s2n_exop.c | 2 +-
src/providers/krb5/krb5_child_handler.c | 4 ++--
src/providers/krb5/krb5_renew_tgt.c | 3 +--
src/providers/ldap/sdap_async_groups.c | 2 +-
src/providers/ldap/sdap_async_initgroups.c | 2 +-
7 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index 3226acc6846837ef0f6d491b8c9796e982de4dc0..843c746d2a724aa63d885ff40d025633ba401833 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -168,7 +168,7 @@ done:
static int mpg_convert(struct ldb_message *msg)
{
struct ldb_message_element *el;
- struct ldb_val *val;
+ struct ldb_val *val = NULL;
int i;
el = ldb_msg_find_element(msg, "objectClass");
diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c
index 8a1c91ea958d41e551fd7cb15d9fa210ebd01366..2384ba68bc1999f51c39df0e89998c8ce4e17e30 100644
--- a/src/providers/ipa/ipa_hbac_common.c
+++ b/src/providers/ipa/ipa_hbac_common.c
@@ -213,7 +213,7 @@ hbac_ctx_to_rules(TALLOC_CTX *mem_ctx,
{
errno_t ret;
struct hbac_rule **new_rules;
- struct hbac_eval_req *new_request;
+ struct hbac_eval_req *new_request = NULL;
size_t i;
TALLOC_CTX *tmp_ctx = NULL;
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index be088664e71fbf8581fd8c3c65d5410bf693016c..bcf966cfd6250536875c18ddfbe7261f8b6c589d 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -586,7 +586,7 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq)
enum sdap_result result;
char *retoid = NULL;
struct berval *retdata = NULL;
- struct resp_attrs *attrs;
+ struct resp_attrs *attrs = NULL;
time_t now;
uint64_t timeout = 10*60*60; /* FIXME: find a better timeout ! */
const char *homedir = NULL;
diff --git a/src/providers/krb5/krb5_child_handler.c b/src/providers/krb5/krb5_child_handler.c
index 99922b410a3b857164c5d7ee3adcf3ab6bb516fc..cc309af34a9f93a93169dac8d839bd6b677aee7d 100644
--- a/src/providers/krb5/krb5_child_handler.c
+++ b/src/providers/krb5/krb5_child_handler.c
@@ -89,7 +89,7 @@ static errno_t pack_authtok(struct io_buffer *buf, size_t *rp,
struct sss_auth_token *tok)
{
uint32_t auth_token_type;
- uint32_t auth_token_length;
+ uint32_t auth_token_length = 0;
const char *data;
size_t len;
errno_t ret = EOK;
@@ -345,7 +345,7 @@ struct tevent_req *handle_child_send(TALLOC_CTX *mem_ctx,
struct tevent_req *req, *subreq;
struct handle_child_state *state;
int ret;
- struct io_buffer *buf;
+ struct io_buffer *buf = NULL;
req = tevent_req_create(mem_ctx, &state, struct handle_child_state);
if (req == NULL) {
diff --git a/src/providers/krb5/krb5_renew_tgt.c b/src/providers/krb5/krb5_renew_tgt.c
index e8957484286b34781f66d5dc43efdf4a3dab4530..f2ee5d91f3bd4b17074e2b1d5df28e9690cf7337 100644
--- a/src/providers/krb5/krb5_renew_tgt.c
+++ b/src/providers/krb5/krb5_renew_tgt.c
@@ -157,7 +157,7 @@ static errno_t renew_all_tgts(struct renew_tgt_ctx *renew_tgt_ctx)
time_t now;
struct auth_data *auth_data;
struct renew_data *renew_data;
- struct tevent_timer *te;
+ struct tevent_timer *te = NULL;
ret = hash_entries(renew_tgt_ctx->tgt_table, &count, &entries);
if (ret != HASH_SUCCESS) {
@@ -197,7 +197,6 @@ static errno_t renew_all_tgts(struct renew_tgt_ctx *renew_tgt_ctx)
entries[c].key.str);
if (auth_data->key.str == NULL) {
DEBUG(1, ("talloc_strdup failed.\n"));
- te = NULL;
} else {
te = tevent_add_timer(renew_tgt_ctx->ev,
auth_data, tevent_timeval_current(),
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index d7885e6b84ff07f3abe316c9689d7f84d7ff2465..5bfa354985f19c811c8e816a84e42c5458ffea13 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -2974,7 +2974,7 @@ sdap_nested_group_check_cache(TALLOC_CTX *mem_ctx,
SYSDB_CREATE_TIME, SYSDB_NAME,
NULL };
char *filter;
- enum sysdb_member_type mtype;
+ enum sysdb_member_type mtype = -1;
size_t count;
tmp_ctx = talloc_new(NULL);
diff --git a/src/providers/ldap/sdap_async_initgroups.c b/src/providers/ldap/sdap_async_initgroups.c
index 4dfb920dcb7ea98516eca27e15f2397d1ddfcc9f..a79ceb59d2417594f2233ff6022b1adc47d7bedd 100644
--- a/src/providers/ldap/sdap_async_initgroups.c
+++ b/src/providers/ldap/sdap_async_initgroups.c
@@ -1048,7 +1048,7 @@ sdap_initgr_store_group_memberships(struct sdap_initgr_nested_state *state)
errno_t ret;
int i, tret;
TALLOC_CTX *tmp_ctx;
- struct membership_diff *miter;
+ struct membership_diff *miter = NULL;
struct membership_diff *memberships = NULL;
bool in_transaction = false;
--
1.8.1.4
_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel