diff --git a/include/jtag/part.h b/include/jtag/part.h index 92b942f9..98b49ced 100644 --- a/include/jtag/part.h +++ b/include/jtag/part.h @@ -29,6 +29,7 @@ #include #include +#include #include typedef struct part part; @@ -38,6 +39,7 @@ struct part { int instruction_length; instruction *instructions; instruction *active_instruction; + data_register *data_registers; int boundary_length; bsbit **bsbits; tap_register *idr; diff --git a/jtag/src/part/part.c b/jtag/src/part/part.c index 2386159d..e4755359 100644 --- a/jtag/src/part/part.c +++ b/jtag/src/part/part.c @@ -40,6 +40,7 @@ part_alloc( void ) p->instruction_length = 0; p->instructions = NULL; p->active_instruction = NULL; + p->data_registers = NULL; p->boundary_length = 0; p->bsbits = NULL; p->idr = NULL; @@ -71,6 +72,12 @@ part_free( part *p ) instruction_free( i ); } + while (p->data_registers) { + data_register *dr = p->data_registers; + p->data_registers = dr->next; + data_register_free( dr ); + } + /* bsbits */ for (i = 0; i < p->boundary_length; i++) bsbit_free( p->bsbits[i] );