diff --git a/src/actions.c b/src/actions.c index 12798dfa..3070d264 100644 --- a/src/actions.c +++ b/src/actions.c @@ -750,6 +750,7 @@ int set_inst_flags(xInstance *inst) const char *ptr; inst->flags &= IGNORE_INST; /* do not clear IGNORE_INST bit, used in draw_symbol() */ my_strdup2(_ALLOC_ID_, &inst->instname, get_tok_value(inst->prop_ptr, "name", 0)); + dbg(1, "set_inst_flags(): instname=%s\n", inst->instname); if(inst->ptr >=0) { char *type = xctx->sym[inst->ptr].type; int cond= type && IS_LABEL_SH_OR_PIN(type); diff --git a/src/store.c b/src/store.c index bce25259..80a17c02 100644 --- a/src/store.c +++ b/src/store.c @@ -68,11 +68,16 @@ void check_inst_storage(void) { if(xctx->instances >= xctx->maxi) { + int i, old = xctx->maxi; + xctx->maxi=(1 + xctx->instances / ELEMINST) * ELEMINST; my_realloc(_ALLOC_ID_, &xctx->inst, sizeof(xInstance)*xctx->maxi); #ifdef ZERO_REALLOC memset(xctx->inst + xctx->instances, 0, sizeof(xInstance) * (xctx->maxi - xctx->instances)); #endif + /* clear all flag bits (to avoid random data in bit 8, that can not be cleraed + * by set_inst_flags() */ + for(i = old; i < xctx->maxi; i++) xctx->inst[i].flags = 0; } }