Skip Menu |

This queue is for tickets about the Net-LibIDN CPAN distribution.

Report information
The Basics
Id: 43110
Status: resolved
Priority: 0/
Queue: Net-LibIDN

People
Owner: Nobody in particular
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.11
Fixed in: (no value)



Subject: Version 1.11 won't run on Win32
Hi, For this module to run on Win32, most of the calls to free() in LibIDN.xs need to be replaced with calls to libidn's idn_free() function. The attached patch to LibIDN.xs (version 0.11) takes care of this. I don't know if idn_free() has always been available, but it certainly exists with libidn-1.12 (which is the libidn version against which I built Net-LibIDN-0.11). Cheers, Rob
Subject: LibIDN_xs.diff
--- LibIDN.xs_orig Sun Feb 8 15:37:48 2009 +++ LibIDN.xs Sun Feb 8 15:46:55 2009 @@ -5,6 +5,7 @@ #include <idna.h> #include <punycode.h> #include <stringprep.h> +#include <idn-free.h> #ifdef HAVE_TLD #include <tld.h> @@ -27,13 +28,13 @@ return NULL; res = stringprep_profile(utf8, &output, profile, 0); - free(utf8); + idn_free(utf8); if( (res != STRINGPREP_OK) || !output) return NULL; res_str = stringprep_convert(output, charset, "UTF-8"); - free(output); + idn_free(output); return res_str; } @@ -96,7 +97,7 @@ if (utf8_str) { res = idna_to_ascii_8z(utf8_str, &tmp_str, flags); - free(utf8_str); + idn_free(utf8_str); } else { @@ -111,7 +112,7 @@ RETVAL CLEANUP: if (tmp_str) - free(tmp_str); + idn_free(tmp_str); char * @@ -133,7 +134,7 @@ if (tmp_str) { res_str = stringprep_convert(tmp_str, charset, "UTF-8"); - free(tmp_str); + idn_free(tmp_str); } else { @@ -147,7 +148,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -167,7 +168,7 @@ if (utf8_str) { q = stringprep_utf8_to_ucs4(utf8_str, -1, &len); - free(utf8_str); + idn_free(utf8_str); } else { @@ -182,7 +183,7 @@ tmp_str = malloc(MAX_DNSLEN*sizeof(char)); len2 = MAX_DNSLEN-1; res = punycode_encode(len, q, NULL, &len2, tmp_str); - free(q); + idn_free(q); if (res != PUNYCODE_SUCCESS) { @@ -201,7 +202,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -239,7 +240,7 @@ if (utf8_str) { res_str = stringprep_convert(utf8_str, charset, "UTF-8"); - free(utf8_str); + idn_free(utf8_str); } else { @@ -254,7 +255,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -274,7 +275,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -294,7 +295,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * idn_prep_node(string, charset=default_charset) @@ -313,7 +314,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -333,7 +334,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -353,7 +354,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -373,7 +374,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -393,7 +394,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); char * @@ -413,7 +414,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); #ifdef HAVE_TLD @@ -450,7 +451,7 @@ XSRETURN_UNDEF; } res = stringprep_profile(utf8_str, &tmp_str, "Nameprep", 0); - free(utf8_str); + idn_free(utf8_str); if (res != STRINGPREP_OK) { XSRETURN_UNDEF; @@ -458,18 +459,18 @@ if (tld) { q = stringprep_utf8_to_ucs4(tmp_str, -1, &len); - free(tmp_str); + idn_free(tmp_str); if (!q) { XSRETURN_UNDEF; } res = tld_check_4t(q, len, &errpos, tld_table); - free(q); + idn_free(q); } else { res = tld_check_8z(tmp_str, &errpos, NULL); - free(tmp_str); + idn_free(tmp_str); } if (res == TLD_SUCCESS) { @@ -507,7 +508,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + idn_free(res_str); SV *
Thanks for the patch, applied in 0.12 idn_free.h seems to be available in GNU Libidn since at least version 0.5, have adjusted requirements accordingly