I'll see if I can patch the XS file so that the tests pass

UPDATE: The correct patch to apply is at https://rt.cpan.org/Ticket/Attachment/564402/285045/LibIDN_xs.diff . See Re: [Win32] "Free to wrong pool ..." error.

Not necessarily the right way to correct it. It may well lead to memory leaks, but at least it renders the module usable on Win32 (in that it enables all of the tests to pass without warning or error):
C:\> diff -u LibIDN.xs_orig LibIDN.xs --- LibIDN.xs_orig Fri Feb 6 11:48:52 2009 +++ LibIDN.xs Fri Feb 6 11:53:00 2009 @@ -27,13 +27,13 @@ return NULL; res = stringprep_profile(utf8, &output, profile, 0); - free(utf8); + /* free(utf8); */ if( (res != STRINGPREP_OK) || !output) return NULL; res_str = stringprep_convert(output, charset, "UTF-8"); - free(output); + /* free(output); */ return res_str; } @@ -96,7 +96,7 @@ if (utf8_str) { res = idna_to_ascii_8z(utf8_str, &tmp_str, fla +gs); - free(utf8_str); + /* free(utf8_str); */ } else { @@ -110,8 +110,8 @@ OUTPUT: RETVAL CLEANUP: - if (tmp_str) - free(tmp_str); + if (tmp_str){} + /* free(tmp_str); */ char * @@ -133,7 +133,7 @@ if (tmp_str) { res_str = stringprep_convert(tmp_str, charset, + "UTF-8"); - free(tmp_str); + /* free(tmp_str); */ } else { @@ -147,7 +147,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ char * @@ -167,7 +167,7 @@ if (utf8_str) { q = stringprep_utf8_to_ucs4(utf8_str, -1, &len +); - free(utf8_str); + /* free(utf8_str); */ } else { @@ -182,7 +182,7 @@ tmp_str = malloc(MAX_DNSLEN*sizeof(char)); len2 = MAX_DNSLEN-1; res = punycode_encode(len, q, NULL, &len2, tmp_str); - free(q); + /* free(q); */ if (res != PUNYCODE_SUCCESS) { @@ -201,7 +201,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ char * @@ -239,7 +239,7 @@ if (utf8_str) { res_str = stringprep_convert(utf8_str, charset +, "UTF-8") ; - free(utf8_str); + /* free(utf8_str); */ } else { @@ -254,7 +254,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ char * @@ -274,7 +274,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ char * @@ -450,7 +450,7 @@ XSRETURN_UNDEF; } res = stringprep_profile(utf8_str, &tmp_str, "Nameprep +", 0); - free(utf8_str); + /* free(utf8_str); */ if (res != STRINGPREP_OK) { XSRETURN_UNDEF; @@ -458,18 +458,18 @@ if (tld) { q = stringprep_utf8_to_ucs4(tmp_str, -1, &len) +; - free(tmp_str); + /* free(tmp_str); */ if (!q) { XSRETURN_UNDEF; } res = tld_check_4t(q, len, &errpos, tld_table) +; - free(q); + /* free(q); */ } else { res = tld_check_8z(tmp_str, &errpos, NULL); - free(tmp_str); + /* free(tmp_str); */ } if (res == TLD_SUCCESS) { @@ -507,7 +507,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ SV *
As you can see, all I've done is remove many of the free() calls. The are possibly other free() calls (not tested by the test suite) that also produce the "Free to wrong pool ..." error.

UPDATE: The correct patch to apply is at https://rt.cpan.org/Ticket/Attachment/564402/285045/LibIDN_xs.diff . See Re: [Win32] "Free to wrong pool ..." error.

Cheers,
Rob

In reply to Re^2: Net::LibIDN in Windows, is it possible? by syphilis
in thread Net::LibIDN in Windows, is it possible? by wilsond

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.