Skip to content

Commit

Permalink
outlook: fix temporary memory leak while listing events
Browse files Browse the repository at this point in the history
As the whole request body is read using io.ReadAll, thus the request can
be freed immediately afterwards.
  • Loading branch information
MichaelEischer committed Oct 10, 2024
1 parent ccdebc5 commit bd9f0b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/adapter/outlook_http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (o *OutlookClient) ListEvents(ctx context.Context, start time.Time, end tim
}

body, _ := io.ReadAll(resp.Body)
defer resp.Body.Close()
resp.Body.Close()

var eventList EventList
err = json.Unmarshal(body, &eventList)
Expand All @@ -62,7 +62,7 @@ func (o *OutlookClient) ListEvents(ctx context.Context, start time.Time, end tim
}

body, _ := io.ReadAll(resp.Body)
defer resp.Body.Close()
resp.Body.Close()

var nextList EventList
err = json.Unmarshal(body, &nextList)
Expand Down

0 comments on commit bd9f0b2

Please sign in to comment.