fix error in capa-2.sym and missing check for null xctx->inst[].instname in get_pin_attr()

This commit is contained in:
Stefan Schippers 2023-11-11 20:03:20 +01:00
parent 8856ab6e0d
commit 8c29d0e812
3 changed files with 7 additions and 7 deletions

View File

@ -821,7 +821,7 @@ void copy_objects(int what)
xctx->inst[xctx->instances].node=NULL;
xctx->inst[xctx->instances].name=NULL;
my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].name, xctx->inst[n].name);
my_strdup(_ALLOC_ID_, &xctx->inst[xctx->instances].prop_ptr, xctx->inst[n].prop_ptr);
my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].prop_ptr, xctx->inst[n].prop_ptr);
my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].lab, xctx->inst[n].lab);
xctx->inst[n].sel=0;
xctx->inst[xctx->instances].embed = xctx->inst[n].embed;
@ -834,7 +834,7 @@ void copy_objects(int what)
xctx->inst[xctx->instances].rot = (xctx->inst[xctx->instances].rot + ( (xctx->move_flip &&
(xctx->inst[xctx->instances].rot & 1) ) ? xctx->move_rot+2 : xctx->move_rot) ) & 0x3;
xctx->inst[xctx->instances].flip = (xctx->move_flip? !xctx->inst[n].flip:xctx->inst[n].flip);
my_strdup(_ALLOC_ID_, &xctx->inst[xctx->instances].instname, xctx->inst[n].instname);
my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].instname, xctx->inst[n].instname);
/* the newpropcnt argument is zero for the 1st call and used in */
/* new_prop_string() for cleaning some internal caches. */
if(!newpropcnt) hash_names(-1, XINSERT);

View File

@ -3379,15 +3379,15 @@ static char *get_pin_attr(const char *token, int inst, int s_pnetname)
char *ss;
int slot;
char *tmpstr = NULL;
tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[inst].instname));
if( (ss=strchr(xctx->inst[inst].instname, ':')) ) {
if( xctx->inst[inst].instname && (ss=strchr(xctx->inst[inst].instname, ':')) ) {
tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[inst].instname));
sscanf(ss+1, "%s", tmpstr);
if(isonlydigit(tmpstr)) {
slot = atoi(tmpstr);
if(strstr(value,":")) my_strdup2(_ALLOC_ID_, &value, find_nth(value, ":", "", 0, slot));
}
my_free(_ALLOC_ID_, &tmpstr);
}
my_free(_ALLOC_ID_, &tmpstr);
}
my_free(_ALLOC_ID_, &pin_attr_value);
my_free(_ALLOC_ID_, &pin_attr_value);

View File

@ -1,4 +1,4 @@
v {xschem version=3.4.4 file_version=1.2
v {xschem version=3.4.5 file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
@ -31,7 +31,7 @@ template="name=C1
m=1
value=1p
footprint=1206
device=polarized_capacitor
device=polarized_capacitor"
}
V {}
S {}