rtmp: Plug leak if sending bytes read report fails.
authorJosh Allmann <joshua.allmann@gmail.com>
Wed, 24 Jan 2018 00:47:12 +0000 (16:47 -0800)
committerMartin Storsjö <martin@martin.st>
Wed, 24 Jan 2018 05:16:06 +0000 (07:16 +0200)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rtmpproto.c

index 115c335..48c5ead 100644 (file)
@@ -2396,8 +2396,10 @@ static int get_packet(URLContext *s, int for_header)
         rt->bytes_read += ret;
         if (rt->bytes_read - rt->last_bytes_read > rt->receive_report_size) {
             av_log(s, AV_LOG_DEBUG, "Sending bytes read report\n");
-            if ((ret = gen_bytes_read(s, rt, rpkt.timestamp + 1)) < 0)
+            if ((ret = gen_bytes_read(s, rt, rpkt.timestamp + 1)) < 0) {
+                ff_rtmp_packet_destroy(&rpkt);
                 return ret;
+            }
             rt->last_bytes_read = rt->bytes_read;
         }