[vlc-commits] access: rar: fix memory leaks of unused naming scheme

Hannes Domani git at videolan.org
Sat Feb 7 16:32:18 CET 2015


vlc | branch: master | Hannes Domani <ssbssa at yahoo.de> | Sat Feb  7 15:44:33 2015 +0100| [4f25e7fd04f78121526a0c7e0fd2c8577f6c3dc6] | committer: Jean-Baptiste Kempf

access: rar: fix memory leaks of unused naming scheme

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/access/rar/access.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/access/rar/access.c b/modules/access/rar/access.c
index 97a69da..3a8f11a 100644
--- a/modules/access/rar/access.c
+++ b/modules/access/rar/access.c
@@ -174,12 +174,16 @@ int RarAccessOpen(vlc_object_t *object)
 
     if (oldscheme.filescount >= newscheme.filescount && oldscheme.i_nbvols > newscheme.i_nbvols)
     {
+        for (int i = 0; i < newscheme.filescount; i++)
+            RarFileDelete(newscheme.files[i]);
         free(newscheme.files);
         p_scheme = &oldscheme;
         msg_Dbg(s, "using rar old naming for %d files nbvols %u", p_scheme->filescount, oldscheme.i_nbvols);
     }
     else if (newscheme.filescount)
     {
+        for (int i = 0; i < oldscheme.filescount; i++)
+            RarFileDelete(oldscheme.files[i]);
         free(oldscheme.files);
         p_scheme = &newscheme;
         msg_Dbg(s, "using rar new naming for %d files nbvols %u", p_scheme->filescount, oldscheme.i_nbvols);
@@ -187,7 +191,11 @@ int RarAccessOpen(vlc_object_t *object)
     else
     {
         msg_Info(s, "Invalid or unsupported RAR archive");
+        for (int i = 0; i < oldscheme.filescount; i++)
+            RarFileDelete(oldscheme.files[i]);
         free(oldscheme.files);
+        for (int i = 0; i < newscheme.filescount; i++)
+            RarFileDelete(newscheme.files[i]);
         free(newscheme.files);
         goto error;
     }



More information about the vlc-commits mailing list