X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fperl.c;h=c25bfe897870a8a83457c1c60e91b59c6767aa3e;hb=5c2993e4121feae745551be182221b31bc23ff97;hp=0a98684e9e809f30be3eb042abe3a254bb028510;hpb=ac077f078300f47d5a6b75aaeeb0999799309283;p=collectd.git diff --git a/src/perl.c b/src/perl.c index 0a98684e..c25bfe89 100644 --- a/src/perl.c +++ b/src/perl.c @@ -1199,7 +1199,10 @@ static void c_ithread_destructor (void *arg) /* the ithread no longer exists */ if (NULL == t) + { + pthread_mutex_unlock (&perl_threads->mutex); return; + } c_ithread_destroy (ithread); @@ -1640,15 +1643,15 @@ static XS (Collectd_plugin_dispatch_values) values = ST (/* stack index = */ 0); + if (NULL == values) + XSRETURN_EMPTY; + /* Make sure the argument is a hash reference. */ if (! (SvROK (values) && (SVt_PVHV == SvTYPE (SvRV (values))))) { log_err ("Collectd::plugin_dispatch_values: Invalid values."); XSRETURN_EMPTY; } - if (NULL == values) - XSRETURN_EMPTY; - ret = pplugin_dispatch_values (aTHX_ (HV *)SvRV (values)); if (0 == ret) @@ -2073,7 +2076,7 @@ static int perl_shutdown (void) return 0; if (NULL == aTHX) { - c_ithread_t *t = NULL; + t = NULL; pthread_mutex_lock (&perl_threads->mutex); t = c_ithread_create (perl_threads->head->interp); @@ -2506,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);