To use free you should include stdlib.h rather than malloc.h according to man page of free() and various C reference websites.
--- a/util-src/encodings.c Fri Nov 28 18:32:54 2008 +0100
+++ b/util-src/encodings.c Fri Nov 28 18:36:04 2008 +0100
@@ -7,7 +7,7 @@
#define _CRT_SECURE_NO_DEPRECATE
#include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
#include "lua.h"
#include "lauxlib.h"