Commit cb6e4c62 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

decode_URI_duplicate: fix error handling

parent d6e4d5a5
...@@ -101,8 +101,8 @@ int main (void) ...@@ -101,8 +101,8 @@ int main (void)
test_decode ("%7E", "~"); test_decode ("%7E", "~");
/* tests with invalid input */ /* tests with invalid input */
test_decode ("%", "%"); test_decode ("%", NULL);
test_decode ("%2", "%2"); test_decode ("%2", NULL);
test_decode ("%0000", ""); test_decode ("%0000", "");
/* Non-ASCII tests */ /* Non-ASCII tests */
......
...@@ -41,7 +41,11 @@ ...@@ -41,7 +41,11 @@
char *decode_URI_duplicate (const char *str) char *decode_URI_duplicate (const char *str)
{ {
char *buf = strdup (str); char *buf = strdup (str);
decode_URI (buf); if (decode_URI (buf) == NULL)
{
free (buf);
buf = NULL;
}
return buf; return buf;
} }
......
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