From a362d1d2abb6b02298b572ae793d7e10ab016a52 Mon Sep 17 00:00:00 2001 From: scruzin Date: Sun, 20 Jan 2019 09:50:51 +1030 Subject: [PATCH] connect() now closes c.link.conn upon an error. --- rtmp/rtmp.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index a6897eef..3352558a 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -174,6 +174,13 @@ func connect(c *Conn) error { return err } c.log(DebugLevel, pkg+"connected") + + defer func() { + if err != nil { + c.link.conn.Close() + } + }() + err = handshake(c) if err != nil { c.log(WarnLevel, pkg+"handshake failed", "error", err.Error())