]> git.sesse.net Git - vlc/commitdiff
decode_URI_duplicate: fix error handling
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 20 Aug 2012 16:35:01 +0000 (19:35 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 20 Aug 2012 16:36:58 +0000 (19:36 +0300)
src/test/url.c
src/text/url.c

index ed6129206c9b354821e0a871b867c51165ac444c..db217a97a965db7f532f1862e7c42920142dfee2 100644 (file)
@@ -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 */
index b03c015f90281c0baa571eca65f238f939ac1a7e..4b0dfb7f7a2e77375d752b7990226fb099e06f0b 100644 (file)
 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;
 }