From 6c13775cddb94909f23637964d4f6bf9929dcd81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Filipovi=C4=8D?= Date: Tue, 21 Aug 2007 15:15:08 +0000 Subject: [PATCH] Fixed coredump in lb_plugin. --- org.glite.lb.server/src/lb_plugin.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/org.glite.lb.server/src/lb_plugin.c b/org.glite.lb.server/src/lb_plugin.c index 0dbe1ba..de08f03 100644 --- a/org.glite.lb.server/src/lb_plugin.c +++ b/org.glite.lb.server/src/lb_plugin.c @@ -832,6 +832,7 @@ static int lb_status(void *handle) { int maxnstates, nstates, i, be_strict = 0, retval; char *errstring; edg_wll_JobStatCode old_state = EDG_WLL_JOB_UNDEF; + int lastStatusHistoryIndex = -1; js = calloc(1, sizeof(intJobStat)); init_intJobStat(js); @@ -850,6 +851,8 @@ static int lb_status(void *handle) { if (nstates >= maxnstates) { maxnstates <<= 1; h->fullStatusHistory = realloc(h->fullStatusHistory, maxnstates * sizeof(lb_historyStatus *)); + if (lastStatusHistoryIndex > -1) + h->lastStatusHistory = &(h->fullStatusHistory[lastStatusHistoryIndex]); } /* job owner and jobId not filled from events normally */ @@ -874,6 +877,7 @@ static int lb_status(void *handle) { /* lastStatusHistory starts from the last WAITING state */ if (js->pub.state == EDG_WLL_JOB_WAITING) { h->lastStatusHistory = &(h->fullStatusHistory[nstates]); + lastStatusHistoryIndex = nstates; } /* finalStatus is the one preceeding the CLEARED state */ if ( (js->pub.state == EDG_WLL_JOB_CLEARED) && (nstates > 0) ) { -- 1.8.2.3