From 232f6a512a0c28d430f7e2e7000c2e80abf21c0c Mon Sep 17 00:00:00 2001
From: jbhusson <jonah@elixxir.io>
Date: Sat, 4 Jun 2022 16:26:41 -0400
Subject: [PATCH] Use defer close

---
 bindings/contact.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings/contact.go b/bindings/contact.go
index e1e7349b0..cf5647bd1 100644
--- a/bindings/contact.go
+++ b/bindings/contact.go
@@ -30,8 +30,8 @@ type Identity struct {
 // MakeIdentity generates a new cryptographic identity for receiving messages
 func (c *Client) MakeIdentity() ([]byte, error) {
 	s := c.api.GetRng().GetStream()
+	defer s.Close()
 	ident, err := api.MakeIdentity(s, c.api.GetStorage().GetE2EGroup())
-	s.Close()
 
 	dhPrivJson, err := ident.DHKeyPrivate.MarshalJSON()
 	if err != nil {
-- 
GitLab