Skip to content

Commit 902078c

Browse files
committed
fix: avoid nil dereference in symbol uploader when temp file creation fails
When os.Create fails in attemptUpload, f is nil. The error handler called os.Remove(f.Name()), which panics with a nil pointer dereference. Remove the call — there is no file to clean up when creation fails, and the defer on the success path already handles it.
1 parent 358d3ed commit 902078c

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

reporter/parca_uploader.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ func (u *ParcaSymbolUploader) attemptUpload(ctx context.Context, fileID libpf.Fi
275275
} else {
276276
f, err := os.Create(filepath.Join(u.tmp, fileID.StringNoQuotes()))
277277
if err != nil {
278-
os.Remove(f.Name())
279278
return fmt.Errorf("create file: %w", err)
280279
}
281280
defer os.Remove(f.Name())

0 commit comments

Comments
 (0)