[vlc-commits] https: fix memory leak

Rémi Denis-Courmont git at videolan.org
Mon Dec 14 22:35:09 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 14 23:34:48 2015 +0200| [ff9ec7d2bad783e4a556943cadeaef2b7d056028] | committer: Rémi Denis-Courmont

https: fix memory leak

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff9ec7d2bad783e4a556943cadeaef2b7d056028
---

 modules/access/http/h2frame.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/access/http/h2frame.c b/modules/access/http/h2frame.c
index 6e71420..5a9504b 100644
--- a/modules/access/http/h2frame.c
+++ b/modules/access/http/h2frame.c
@@ -528,8 +528,8 @@ static int vlc_h2_parse_headers_end(struct vlc_h2_parser *p)
     {
         for (unsigned i = 0; i < VLC_H2_MAX_HEADERS; i++)
         {
-            free(headers[i][1]);
             free(headers[i][0]);
+            free(headers[i][1]);
         }
         val = -1;
     }
@@ -543,10 +543,17 @@ static int vlc_h2_parse_headers_end(struct vlc_h2_parser *p)
         val = 0;
     }
     else
+    {
+        for (int i = 0; i < val; i++)
+        {
+            free(headers[i][0]);
+            free(headers[i][1]);
+        }
         /* NOTE: The specification implies that the error should also be sent
          * for non-last header/continuation frames, but this does not make much
          * sense. */
         val = vlc_h2_stream_error(p, p->headers.sid, VLC_H2_REFUSED_STREAM);
+    }
 
     if (p->headers.eos && s != NULL)
         p->cbs->stream_end(s);



More information about the vlc-commits mailing list