src/plugin.c: unregister_read: llist_search may return NULL.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 29 Aug 2009 11:58:56 +0000 (13:58 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 29 Aug 2009 11:58:56 +0000 (13:58 +0200)
Handle these cases gracefully.

src/plugin.c

index 70e0c0f..6fb7520 100644 (file)
@@ -888,6 +888,14 @@ int plugin_unregister_read (const char *name) /* {{{ */
        }
 
        le = llist_search (read_list, name);
+       if (le == NULL)
+       {
+               pthread_mutex_unlock (&read_lock);
+               WARNING ("plugin_unregister_read: No such read function: %s",
+                               name);
+               return (-ENOENT);
+       }
+
        llist_remove (read_list, le);
 
        rf = le->value;