Skip to content

Commit bd2ac2c

Browse files
committed
fixes preallocated slice bug
1 parent 83e12cd commit bd2ac2c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

vulndb/gob_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ func gobExploitToModel(g GobExploit) models.Exploit {
121121
}
122122

123123
func gobExploitsToModels(gs []GobExploit, lastImportTime time.Time) []models.Exploit {
124-
out := make([]models.Exploit, len(gs))
125-
for i, g := range gs {
124+
out := make([]models.Exploit, 0, len(gs))
125+
for _, g := range gs {
126126
if g.Updated != nil && g.Updated.Before(lastImportTime) {
127127
continue
128128
}
129-
out[i] = gobExploitToModel(g)
129+
out = append(out, gobExploitToModel(g))
130130
}
131131
return out
132132
}

0 commit comments

Comments
 (0)