diff --git a/deviceauth.go b/deviceauth.go
index e99c92f39..a0354c5d2 100644
--- a/deviceauth.go
+++ b/deviceauth.go
@@ -111,6 +111,7 @@ func retrieveDeviceAuth(ctx context.Context, c *Config, v url.Values) (*DeviceAu
 		return nil, err
 	}
 
+	defer r.Body.Close()
 	body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))
 	if err != nil {
 		return nil, fmt.Errorf("oauth2: cannot auth device: %v", err)