perl plugin: Check "return value" of PERL_GET_CONTEXT.
authorFlorian Forster <octo@collectd.org>
Thu, 17 Dec 2015 14:13:39 +0000 (15:13 +0100)
committerFlorian Forster <octo@collectd.org>
Thu, 17 Dec 2015 14:13:53 +0000 (15:13 +0100)
CID: 37985

src/perl.c

index 67cb842..d42afc2 100644 (file)
@@ -2509,7 +2509,10 @@ static int perl_config (oconfig_item_t *ci)
                int current_status = 0;
 
                if (NULL != perl_threads)
-                       aTHX = PERL_GET_CONTEXT;
+               {
+                       if ((aTHX = PERL_GET_CONTEXT) == NULL)
+                               return -1;
+               }
 
                if (0 == strcasecmp (c->key, "LoadPlugin"))
                        current_status = perl_config_loadplugin (aTHX_ c);