Fix memory leak on error

This commit is contained in:
Chris Young 2014-06-10 19:27:39 +01:00
parent 837b8f9434
commit 2462f5658e
1 changed files with 2 additions and 0 deletions

View File

@ -565,6 +565,7 @@ static bool idna__verify(const char *label, size_t len)
ucs4_len = utf8proc_normalise(ucs4, u_ucs4_len,
UTF8PROC_STABLE | UTF8PROC_COMPOSE);
if (ucs4_len < 0) {
free(ucs4);
return false;
}
@ -611,6 +612,7 @@ idna_encode(const char *host, size_t len, char **ace_host, size_t *ace_len)
/* Check this is valid for conversion */
if (idna__is_valid(ucs4_host, ucs4_len) == false) {
free(ucs4_host);
return NSERROR_BAD_URL;
}