Commit 5256425c authored by ALIS superuser's avatar ALIS superuser
Browse files

goptaverk: fixed bug causing segfault, improved error messages on missing variables

parent 09697762
......@@ -459,6 +459,14 @@ static gopta_t *goptainit(int *barf, int *fd)
SETBARF(barf,errno,"Couldn't malloc %d bytes (%d * %d items)",
sizeof(item_t)*g->nitems,sizeof(item_t),g->nitems);
}
else /* Set all stringpointers to NULL to avoid segfault on free */
{
for (i=0;(i<g->nitems)&&(*barf==0);i++)
{
g->itp[i].expose=NULL;
g->itp[i].position=NULL;
}
}
/* itemN */
for (i=0;(i<g->nitems)&&(*barf==0);i++)
......@@ -472,6 +480,7 @@ static gopta_t *goptainit(int *barf, int *fd)
}
s=findvar_stri(barf,GOPTA_FILTER,i);
symbarfi(barf,GOPTA_FILTER,i);
if(s!=NULL)
{
getfilterpos(barf,fd,&g->itp[i].filter,s);
......@@ -480,7 +489,9 @@ static gopta_t *goptainit(int *barf, int *fd)
timerclear(&g->itp[i].filter_change_time);
g->itp[i].expose=findvar_stri(barf,GOPTA_EXPOSE,i);
symbarfi(barf,GOPTA_EXPOSE,i);
g->itp[i].position=findvar_stri(barf,GOPTA_POSITION,i);
symbarfi(barf,GOPTA_POSITION,i);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment