# HG changeset patch
# User Waqas Hussain <waqas20@gmail.com>
# Date 1253640075 -18000
# Node ID 3d0db768be2f364bbfefd29db2aea7229ee70038
# Parent  2683cdaf6dc8b1d34d7432f2ea2f79c24425ec90
util.encodings: Fixed an issue with cross-module memory deallocation (crashes on some windows versions).

diff -r 2683cdaf6dc8 -r 3d0db768be2f util-src/encodings.c
--- a/util-src/encodings.c	Mon Sep 21 17:59:21 2009 +0100
+++ b/util-src/encodings.c	Tue Sep 22 22:21:15 2009 +0500
@@ -172,11 +172,11 @@
 	int ret = idna_to_ascii_8z(s, &output, 0);
 	if (ret == IDNA_SUCCESS) {
 		lua_pushstring(L, output);
-		if (output) free(output);
+		idn_free(output);
 		return 1;
 	} else {
 		lua_pushnil(L);
-		if (output) free(output);
+		idn_free(output);
 		return 1; // TODO return error message
 	}
 }
@@ -189,11 +189,11 @@
 	int ret = idna_to_unicode_8z8z(s, &output, 0);
 	if (ret == IDNA_SUCCESS) {
 		lua_pushstring(L, output);
-		if (output) free(output);
+		idn_free(output);
 		return 1;
 	} else {
 		lua_pushnil(L);
-		if (output) free(output);
+		idn_free(output);
 		return 1; // TODO return error message
 	}
 }