Code

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 70e0c0ffcf367e5f030e86a394fddf7e2d7c315c..6fb75206a686cecebafc78b91389901d892e1f75 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;