From: Jiří Filipovič Date: Tue, 21 Aug 2007 15:15:08 +0000 (+0000) Subject: Fixed coredump in lb_plugin. X-Git-Tag: glite-lb-client_R_3_0_1_1~41 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=6c13775cddb94909f23637964d4f6bf9929dcd81;p=jra1mw.git Fixed coredump in lb_plugin. --- 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) ) {