From: Alexander Drozdov <[email protected]>

Prevent possible memory leaks.

Connecting to nginx and request a non-existent resource can trigger
it.

Signed-off-by: Michael Niedermayer <[email protected]>
Signed-off-by: Uwe L. Korn <[email protected]>
Signed-off-by: Luca Barbato <[email protected]>
---

Even above there is another instance.

 libavformat/rtmpproto.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 55987b7..d0e9792 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2817,11 +2817,10 @@ reconnect:
     }

     if (rt->is_input) {
-        int err;
         // generate FLV header for demuxer
         rt->flv_size = 13;
-        if ((err = av_reallocp(&rt->flv_data, rt->flv_size)) < 0)
-            return err;
+        if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0)
+            goto fail;
         rt->flv_off  = 0;
         memcpy(rt->flv_data, "FLV\1\0\0\0\0\011\0\0\0\0", rt->flv_size);

@@ -2832,7 +2831,7 @@ reconnect:
         // audio or video packet arrives.
         while (!rt->has_audio && !rt->has_video && !rt->received_metadata) {
             if ((ret = get_packet(s, 0)) < 0)
-               return ret;
+               goto fail;
         }

         // Either after we have read the metadata or (if there is none) the
--
2.1.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to