Skip to content

Commit c7f410e

Browse files
committed
fixed memory leaks
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent d92c9b5 commit c7f410e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,6 @@ static void LoadPinLoc(pugi::xml_node Locations,
790790

791791
} else {
792792
VTR_ASSERT(type->pin_location_distribution == E_CUSTOM_PIN_DISTR);
793-
int count = 0;
794793
for (int width = 0; width < type->width; ++width) {
795794
for (int height = 0; height < type->height; ++height) {
796795
for (e_side side : {TOP, RIGHT, BOTTOM, LEFT}) {
@@ -807,7 +806,6 @@ static void LoadPinLoc(pugi::xml_node Locations,
807806
type->pin_width_offset[pin_num + capacity * type->num_pins / type->capacity] += width;
808807
type->pin_height_offset[pin_num + capacity * type->num_pins / type->capacity] += height;
809808
physical_pin_counts[pin_num + capacity * type->num_pins / type->capacity] += 1;
810-
VTR_ASSERT(count < type->num_pins);
811809
}
812810
}
813811
}
@@ -868,6 +866,7 @@ static std::pair<int, int> ProcessCustomPinLoc(pugi::xml_node Locations,
868866

869867
// All the pins of the port are taken or the port has a single pin
870868
if (token_index == num_tokens) {
869+
freeTokens(tokens, num_tokens);
871870
return std::make_pair(abs_first_pin_idx, abs_first_pin_idx + port->num_pins);
872871
}
873872

@@ -905,6 +904,7 @@ static std::pair<int, int> ProcessCustomPinLoc(pugi::xml_node Locations,
905904
"pin location should be completed, but more tokens are present: %s\n", pin_loc_string);
906905
}
907906

907+
freeTokens(tokens, num_tokens);
908908
return std::make_pair(abs_first_pin_idx + first_pin, abs_first_pin_idx + first_pin + 1);
909909
}
910910

@@ -937,6 +937,7 @@ static std::pair<int, int> ProcessCustomPinLoc(pugi::xml_node Locations,
937937
std::swap(first_pin, last_pin);
938938
}
939939

940+
freeTokens(tokens, num_tokens);
940941
return std::make_pair(abs_first_pin_idx + first_pin, abs_first_pin_idx + last_pin + 1);
941942
}
942943

0 commit comments

Comments
 (0)