[vlc-commits] Fix leak in error path

Petri Hintukainen git at videolan.org
Tue Dec 1 14:09:37 CET 2015


vlc/vlc-2.2 | branch: master | Petri Hintukainen <phintuka at gmail.com> | Mon Nov 23 09:31:46 2015 +0200| [d1a8ead166bfbadddebf6ff379d3d4f57e260965] | committer: Jean-Baptiste Kempf

Fix leak in error path

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit d9a8f8cd91064ca27c035094952983f2df510096)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 include/vlc_charset.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/vlc_charset.h b/include/vlc_charset.h
index 4de57ab..3119e89 100644
--- a/include/vlc_charset.h
+++ b/include/vlc_charset.h
@@ -85,8 +85,10 @@ static inline char *ToCodePage (unsigned cp, const char *utf8)
         return NULL;
 
     size_t len = WideCharToMultiByte (cp, 0, wide, -1, NULL, 0, NULL, NULL);
-    if (len == 0)
+    if (len == 0) {
+        free(wide);
         return NULL;
+    }
 
     char *out = (char *)malloc (len);
     if (likely(out != NULL))



More information about the vlc-commits mailing list