[vlc-commits] decode_URI_duplicate: fix error handling

Rémi Denis-Courmont git at videolan.org
Mon Aug 20 19:36:12 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 20 19:35:01 2012 +0300| [cb6e4c6210068a222f63663b241551f03ab86022] | committer: Rémi Denis-Courmont

decode_URI_duplicate: fix error handling

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

 src/test/url.c |    4 ++--
 src/text/url.c |    6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/test/url.c b/src/test/url.c
index ed61292..db217a9 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -101,8 +101,8 @@ int main (void)
     test_decode ("%7E", "~");
 
     /* tests with invalid input */
-    test_decode ("%", "%");
-    test_decode ("%2", "%2");
+    test_decode ("%", NULL);
+    test_decode ("%2", NULL);
     test_decode ("%0000", "");
 
     /* Non-ASCII tests */
diff --git a/src/text/url.c b/src/text/url.c
index b03c015..4b0dfb7 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -41,7 +41,11 @@
 char *decode_URI_duplicate (const char *str)
 {
     char *buf = strdup (str);
-    decode_URI (buf);
+    if (decode_URI (buf) == NULL)
+    {
+        free (buf);
+        buf = NULL;
+    }
     return buf;
 }
 



More information about the vlc-commits mailing list