From b29b87a7c5344c31e6975200f91a0675ef8bcb70 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Tue, 26 Oct 2021 12:35:24 +0200 Subject: [PATCH] controller: `Free` remaining `libgit2` objects This supersedes #238. Signed-off-by: Hidde Beydals --- controllers/imageupdateautomation_controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/imageupdateautomation_controller.go b/controllers/imageupdateautomation_controller.go index 56bccdd0..f24ae640 100644 --- a/controllers/imageupdateautomation_controller.go +++ b/controllers/imageupdateautomation_controller.go @@ -628,10 +628,12 @@ func fetch(ctx context.Context, path string, branch string, access repoAccess) e if err != nil { return err } + defer repo.Free() origin, err := repo.Remotes.Lookup(originRemote) if err != nil { return err } + defer origin.Free() err = origin.Fetch( []string{refspec}, &libgit2.FetchOptions{ @@ -653,10 +655,12 @@ func push(ctx context.Context, path, branch string, access repoAccess) error { if err != nil { return err } + defer repo.Free() origin, err := repo.Remotes.Lookup(originRemote) if err != nil { return err } + defer origin.Free() callbacks := access.remoteCallbacks()