[vlc-commits] codec: opus: fix leak

Francois Cartegnie git at videolan.org
Thu Dec 8 11:59:21 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec  8 11:05:57 2016 +0100| [eda1ff2df82f8528978ac4c4cd258f6f6324801f] | committer: Francois Cartegnie

codec: opus: fix leak

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

 modules/codec/opus_header.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/codec/opus_header.c b/modules/codec/opus_header.c
index d00cfdd..34ff5bb 100644
--- a/modules/codec/opus_header.c
+++ b/modules/codec/opus_header.c
@@ -402,12 +402,18 @@ int opus_write_header(uint8_t **p_extra, int *i_extra, OpusHeader *header, const
     data[1] = (unsigned char *) comments;
     size[1] = comments_length;
 
+    *i_extra = 0;
+    *p_extra = NULL;
+
     for (unsigned i = 0; i < ARRAY_SIZE(data); ++i)
+    {
         if (xiph_AppendHeaders(i_extra, (void **) p_extra, size[i], data[i]))
         {
             *i_extra = 0;
+            free(*p_extra);
             *p_extra = NULL;
         }
+    }
 
     return 0;
 }



More information about the vlc-commits mailing list