Allocate auxv with better capacity while loading stack

This commit is contained in:
Joe Hattori
2022-01-23 13:05:38 -05:00
parent 9df539f9e8
commit e66d177645
+1 -1
View File
@@ -190,7 +190,7 @@ func (s *Stack) Load(args []string, env []string, aux Auxv) (StackLayout, error)
// NOTE: We need an extra zero here per spec.
// The Push function will automatically terminate
// strings and arrays with a single null value.
auxv := make([]hostarch.Addr, 0, len(aux))
auxv := make([]hostarch.Addr, 0, len(aux)*2+1)
for _, a := range aux {
auxv = append(auxv, hostarch.Addr(a.Key), a.Value)
}