From: Sebastian Harl Date: Sun, 18 Nov 2007 19:37:36 +0000 (+0100) Subject: perl plugin: Fixed error in ithread shutdown loop. X-Git-Tag: collectd-4.3.0beta0~87 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=368a2bc5559829b5f4325301364790efeb9de236;p=collectd.git perl plugin: Fixed error in ithread shutdown loop. Using the sfree() macro, the loop variable was accidentally set to NULL at the end of the loop, causing the loop to terminate after the first iteration. --- diff --git a/src/perl.c b/src/perl.c index d6371dba..5cec1ed8 100644 --- a/src/perl.c +++ b/src/perl.c @@ -945,9 +945,13 @@ static int perl_shutdown (void) t = perl_threads->tail; while (NULL != t) { + c_ithread_t *last = NULL; + aTHX = t->interp; PERL_SET_CONTEXT (aTHX); + log_debug ("Shutting down Perl interpreter %p...", aTHX); + #if COLLECT_DEBUG sv_report_used (); #endif /* COLLECT_DEBUG */ @@ -955,9 +959,10 @@ static int perl_shutdown (void) perl_destruct (aTHX); perl_free (aTHX); + last = t; t = t->prev; - sfree (t); + sfree (last); } pthread_mutex_unlock (&perl_threads->mutex);