From: Sven Trenkel Date: Mon, 3 May 2010 13:01:56 +0000 (+0200) Subject: python: Fixed a crash if the plugin was loaded but not configured. X-Git-Tag: collectd-4.9.3~21 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2195f16f6e7c0ba14bb0b04fab98c1b416bfd14d;p=collectd.git python: Fixed a crash if the plugin was loaded but not configured. --- diff --git a/src/python.c b/src/python.c index d750d95b..7a92b485 100644 --- a/src/python.c +++ b/src/python.c @@ -828,6 +828,11 @@ static int cpy_init(void) { static pthread_t thread; sigset_t sigset; + if (!Py_IsInitialized()) { + WARNING("python: Plugin loaded but not configured."); + plugin_unregister_shutdown("python"); + return 0; + } PyEval_InitThreads(); /* Now it's finally OK to use python threads. */ for (c = cpy_init_callbacks; c; c = c->next) {