--- collectd-pristine/src/utils_llist.h	2007-12-11 17:31:31.526987625 +0000
+++ collectd/src/utils_llist.h	2007-12-11 23:23:59.652078544 +0000
@@ -44,13 +44,15 @@ typedef struct llist_s llist_t;
 llist_t *llist_create (void);
 void llist_destroy (llist_t *l);
 
-llentry_t *llentry_create (const char *key, void *value);
+llentry_t *llentry_create (char *key, void *value);
 void llentry_destroy (llentry_t *e);
 
 void llist_append (llist_t *l, llentry_t *e);
 void llist_prepend (llist_t *l, llentry_t *e);
 void llist_remove (llist_t *l, llentry_t *e);
 
+int llist_size (llist_t *l);
+
 llentry_t *llist_search (llist_t *l, const char *key);
 
 llentry_t *llist_head (llist_t *l);
--- collectd-pristine/src/utils_llist.c	2007-12-11 17:31:31.526987625 +0000
+++ collectd/src/utils_llist.c	2007-12-11 23:23:45.192112312 +0000
@@ -35,6 +35,7 @@ struct llist_s
 {
 	llentry_t *head;
 	llentry_t *tail;
+	int size;
 };
 
 /*
@@ -67,22 +68,16 @@ void llist_destroy (llist_t *l)
 	free (l);
 }
 
-llentry_t *llentry_create (const char *key, void *value)
+llentry_t *llentry_create (char *key, void *value)
 {
 	llentry_t *e;
 
 	e = (llentry_t *) malloc (sizeof (llentry_t));
-	if (e == NULL)
-		return (NULL);
-
-	e->key   = strdup (key);
-	e->value = value;
-	e->next  = NULL;
-
-	if (e->key == NULL)
+	if (e)
 	{
-		free (e);
-		return (NULL);
+		e->key   = key;
+		e->value = value;
+		e->next  = NULL;
 	}
 
 	return (e);
@@ -90,7 +85,6 @@ llentry_t *llentry_create (const char *k
 
 void llentry_destroy (llentry_t *e)
 {
-	free (e->key);
 	free (e);
 }
 
@@ -104,12 +98,15 @@ void llist_append (llist_t *l, llentry_t
 		l->tail->next = e;
 
 	l->tail = e;
+
+	++(l->size);
 }
 
 void llist_prepend (llist_t *l, llentry_t *e)
 {
 	e->next = l->head;
 	l->head = e;
+	++(l->size);
 }
 
 void llist_remove (llist_t *l, llentry_t *e)
@@ -126,6 +123,13 @@ void llist_remove (llist_t *l, llentry_t
 		l->head = e->next;
 	if (l->tail == e)
 		l->tail = prev;
+
+	--(l->size);
+}
+
+int llist_size (llist_t *l)
+{
+	return (l ? l->size : 0);
 }
 
 llentry_t *llist_search (llist_t *l, const char *key)
--- collectd-pristine/src/plugin.c	2007-12-11 17:31:31.454987812 +0000
+++ collectd/src/plugin.c	2007-12-11 23:23:23.284163468 +0000
@@ -79,6 +79,7 @@ static const char *plugin_get_dir (void)
 static int register_callback (llist_t **list, const char *name, void *callback)
 {
 	llentry_t *le;
+	char *key;
 
 	if ((*list == NULL)
 			&& ((*list = llist_create ()) == NULL))
@@ -87,9 +88,16 @@ static int register_callback (llist_t **
 	le = llist_search (*list, name);
 	if (le == NULL)
 	{
-		le = llentry_create (name, callback);
+		key = strdup (name);
+		if (key == NULL)
+			return (-1);
+
+		le = llentry_create (key, callback);
 		if (le == NULL)
+		{
+			free (key);
 			return (-1);
+		}
 
 		llist_append (*list, le);
 	}
@@ -111,6 +119,7 @@ static int plugin_unregister (llist_t *l
 		return (-1);
 
 	llist_remove (list, e);
+	free (e->key);
 	llentry_destroy (e);
 
 	return (0);
@@ -499,6 +508,7 @@ int plugin_unregister_read (const char *
 
 	llist_remove (list_read, e);
 	free (e->value);
+	free (e->key);
 	llentry_destroy (e);
 
 	return (0);
@@ -529,6 +539,7 @@ int plugin_unregister_data_set (const ch
 
 	llist_remove (list_data_set, e);
 	ds = (data_set_t *) e->value;
+	free (e->key);
 	llentry_destroy (e);
 
 	sfree (ds->ds);
