summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: da526fa)
raw | patch | inline | side by side (parent: da526fa)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 20 Jun 2009 10:50:21 +0000 (12:50 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 20 Jun 2009 10:51:13 +0000 (12:51 +0200) |
Unfortunately, there is quite some magic going on there :/
src/utils_cache.c | patch | blob | history |
diff --git a/src/utils_cache.c b/src/utils_cache.c
index 5f7181b0a363329424f9bb82b8bed1afc61eb0f9..3cfe3a12c4965c915d94ca92d0cd312a355bdd0e 100644 (file)
--- a/src/utils_cache.c
+++ b/src/utils_cache.c
(keys_len + 1) * sizeof (char *));
if (tmp == NULL)
{
- ERROR ("uc_purge: realloc failed.");
+ ERROR ("uc_check_timeout: realloc failed.");
c_avl_iterator_destroy (iter);
+ sfree (keys);
pthread_mutex_unlock (&cache_lock);
return (-1);
}
}
} /* while (c_avl_iterator_next) */
+ ce = NULL;
+
for (i = 0; i < keys_len; i++)
{
int status;
{
ERROR ("uc_check_timeout: ut_check_interesting failed.");
sfree (keys[i]);
+ continue;
}
else if (status == 0) /* ``service'' is uninteresting */
{
- ce = NULL;
DEBUG ("uc_check_timeout: %s is missing but ``uninteresting''",
keys[i]);
status = c_avl_remove (cache_tree, keys[i],
DEBUG ("uc_check_timeout: %s is missing, sending notification.",
keys[i]);
ce->state = STATE_MISSING;
+ /* Do not free `keys[i]' so a notification is sent further down. */
}
else if (status == 1) /* do not persist */
{
DEBUG ("uc_check_timeout: %s is missing but "
"notification has already been sent.",
keys[i]);
+ /* Set `keys[i]' to NULL to no notification is sent. */
sfree (keys[i]);
}
else /* (ce->state != STATE_MISSING) */
DEBUG ("uc_check_timeout: %s is missing, sending one notification.",
keys[i]);
ce->state = STATE_MISSING;
+ /* Do not free `keys[i]' so a notification is sent further down. */
}
}
else
WARNING ("uc_check_timeout: ut_check_interesting (%s) returned "
"invalid status %i.",
keys[i], status);
+ sfree (keys[i]);
}
} /* for (keys[i]) */