Commit 4f25e7fd authored by Hannes Domani's avatar Hannes Domani Committed by Jean-Baptiste Kempf

access: rar: fix memory leaks of unused naming scheme

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 6344d9bb
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment