resolved a memory leak (inst[..].instname)

This commit is contained in:
Stefan Schippers 2023-05-14 17:10:48 +02:00
parent 96eea54894
commit d577bdde7a
3 changed files with 3 additions and 1 deletions

View File

@ -698,7 +698,6 @@ int set_sym_flags(xSymbol *sym)
int set_inst_flags(xInstance *inst)
{
inst->flags=0;
inst->instname=NULL;
my_strdup2(_ALLOC_ID_, &inst->instname, get_tok_value(inst->prop_ptr, "name", 0));
if(!strcmp(get_tok_value(inst->prop_ptr,"hide",0), "true"))
@ -1208,6 +1207,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot
xctx->inst[n].sel=0;
xctx->inst[n].node=NULL;
xctx->inst[n].prop_ptr=NULL;
xctx->inst[n].instname=NULL;
dbg(1, "place_symbol() :all inst_ptr members set\n"); /* 03-02-2000 */
if(first_call) hash_all_names();
if(inst_props) {

View File

@ -268,6 +268,7 @@ static void merge_inst(int k,FILE *fd)
xctx->inst[i].sel=0;
xctx->inst[i].color=-10000;
xctx->inst[i].ptr=-1;
xctx->inst[i].instname=NULL;
xctx->inst[i].prop_ptr=NULL;
xctx->inst[i].lab=NULL; /* assigned in link_symbols_to_instances */
xctx->inst[i].node=NULL;

View File

@ -1891,6 +1891,7 @@ static void load_inst(int k, FILE *fd)
xctx->inst[i].color=-10000;
xctx->inst[i].sel=0;
xctx->inst[i].ptr=-1; /*04112003 was 0 */
xctx->inst[i].instname=NULL;
xctx->inst[i].prop_ptr=NULL;
xctx->inst[i].lab=NULL; /* assigned in link_symbols_to_instances */
xctx->inst[i].node=NULL;