From 992395dec390b242506d3c845dc789b5710736b5 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 19 May 2026 18:44:55 +0200 Subject: [PATCH] Ensure proper disposal of resources in InvokeAsync Updated the `InvokeAsync` method in the `ReC.Client.Api` namespace to use `using` statements for the `content` and `resp` objects. This change ensures proper disposal of these resources, improving memory management and preventing potential leaks. The functional behavior of the method remains unchanged. --- src/ReC.Client/Api/RecActionApi.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ReC.Client/Api/RecActionApi.cs b/src/ReC.Client/Api/RecActionApi.cs index 02fd898..6c6be6d 100644 --- a/src/ReC.Client/Api/RecActionApi.cs +++ b/src/ReC.Client/Api/RecActionApi.cs @@ -27,8 +27,11 @@ namespace ReC.Client.Api public async Task InvokeAsync(int profileId, InvokeReferences references, CancellationToken cancellationToken = default) { var content = references != null ? ReCClientHelpers.ToJsonContent(references) : null; - var resp = await Http.PostAsync($"{ResourcePath}/invoke/{profileId}", content, cancellationToken); - return resp.IsSuccessStatusCode; + using (content) + using (var resp = await Http.PostAsync($"{ResourcePath}/invoke/{profileId}", content, cancellationToken)) + { + return resp.IsSuccessStatusCode; + } } ///