From 0bb027f032cae1267c7d4210042878a22f107650 Mon Sep 17 00:00:00 2001 From: fachat Date: Sun, 29 Jul 2012 19:05:02 +0200 Subject: [PATCH] Fix memory pointer bug if index is -1 --- xa/src/xal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xa/src/xal.c b/xa/src/xal.c index 3d3b32e..6779e98 100644 --- a/xa/src/xal.c +++ b/xa/src/xal.c @@ -608,8 +608,10 @@ static int ll_def(char *s, int *n, int b, label_t ltype) ltp->blknext = -1; // no next block ltp->blkprev = b_link( afile->la.lti ); // previous block, linked within block - ltp = afile->la.lt + ltp->blkprev; - ltp->blknext = afile->la.lti; + if (ltp->blkprev != -1) { + ltp = afile->la.lt + ltp->blkprev; + ltp->blknext = afile->la.lti; + } *n=afile->la.lti; // return the list index for that file in the out parameter n afile->la.lti++; // increase last index in lable table