Skip to content

fix: dispose JsonDocument instances in Player.cs - #777

Open
Bolt4243 wants to merge 1 commit into
mpvnet-player:mainfrom
Bolt4243:fix/json-document-leak
Open

fix: dispose JsonDocument instances in Player.cs#777
Bolt4243 wants to merge 1 commit into
mpvnet-player:mainfrom
Bolt4243:fix/json-document-leak

Conversation

@Bolt4243

Copy link
Copy Markdown

JsonDocument implements IDisposable and rents a buffer from ArrayPool<byte>. Four call sites in Player.cs parse JSON without ever disposing the document, leaking the pooled buffer on every call:

  • AudioDevices getter (GetPropertyString("audio-device-list"))
  • ProfileNames getter (GetPropertyString("profile-list"))
  • GetProfiles() (GetPropertyString("profile-list"))
  • GetDecoders() (GetPropertyString("decoder-list"))

Each site now wraps the JsonDocument in a using block/declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant