Skip to content

Commit

Permalink
Validate unit test can detect wrong implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
tnqn committed Oct 15, 2024
1 parent 9396532 commit 1bcae44
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pkg/agent/util/syscall/syscall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,7 @@ func (n *netIO) ListIPForwardRows(family uint16) ([]MibIPForwardRow, error) {
}
defer n.freeMibTable(unsafe.Pointer(table))

// Copy the rows from the table into a new slice as the table's memory will be freed.
// Since MibIPForwardRow contains only value data (no references), the operation performs a deep copy.
rows := make([]MibIPForwardRow, 0, table.NumEntries)
rows = append(rows, unsafe.Slice(&table.Table[0], table.NumEntries)...)
return rows, nil
return unsafe.Slice(&table.Table[0], table.NumEntries), nil
}

func NewIPForwardRow() *MibIPForwardRow {
Expand Down

0 comments on commit 1bcae44

Please sign in to comment.