[PR #14589] Fix: resource leak and formatting issues #25275

Open
opened 2026-04-19 18:07:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14589
Author: @hobostay
Created: 3/3/2026
Status: 🔄 Open

Base: mainHead: fix/file-resource-leak


📝 Commits (1)

  • 47fb3e0 Fix: resource leak and formatting issues

📊 Changes

2 files changed (+2 additions, -2 deletions)

View changed files

📝 server/create.go (+1 -1)
📝 server/download.go (+1 -1)

📄 Description

Summary

This PR fixes two minor issues found in the codebase:

1. Fix potential file descriptor leak in server/create.go

  • Changed cfgFile.Close() to defer cfgFile.Close()
  • Ensures the file is always closed, even if panic occurs during JSON decoding
  • Follows Go best practices for resource management

2. Fix incorrect fmt.Errorf syntax in server/download.go

  • Removed redundant parentheses around format string
  • Changed fmt.Errorf(("%s: %s"), ...) to fmt.Errorf("%s: %s", ...)

Test plan

  • Code review confirms the changes are correct
  • No functional behavior changes expected
  • Follows Go idioms for resource cleanup

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14589 **Author:** [@hobostay](https://github.com/hobostay) **Created:** 3/3/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/file-resource-leak` --- ### 📝 Commits (1) - [`47fb3e0`](https://github.com/ollama/ollama/commit/47fb3e0ef6630ae553300dd12bcb755918c143aa) Fix: resource leak and formatting issues ### 📊 Changes **2 files changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `server/create.go` (+1 -1) 📝 `server/download.go` (+1 -1) </details> ### 📄 Description ## Summary This PR fixes two minor issues found in the codebase: ### 1. Fix potential file descriptor leak in `server/create.go` - Changed `cfgFile.Close()` to `defer cfgFile.Close()` - Ensures the file is always closed, even if panic occurs during JSON decoding - Follows Go best practices for resource management ### 2. Fix incorrect `fmt.Errorf` syntax in `server/download.go` - Removed redundant parentheses around format string - Changed `fmt.Errorf(("%s: %s"), ...)` to `fmt.Errorf("%s: %s", ...)` ## Test plan - [ ] Code review confirms the changes are correct - [ ] No functional behavior changes expected - [ ] Follows Go idioms for resource cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 18:07:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#25275