linenoiseFree() API introduced.
diff --git a/linenoise.c b/linenoise.c
index 193adff..0c1fee2 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -1050,6 +1050,14 @@
     }
 }
 
+/* This is just a wrapper the user may want to call in order to make sure
+ * the linenoise returned buffer is freed with the same allocator it was
+ * created with. Useful when the main program is using an alternative
+ * allocator. */
+void linenoiseFree(void *ptr) {
+    free(ptr);
+}
+
 /* ================================ History ================================= */
 
 /* Free the history, but does not reset it. Only used when we have to
diff --git a/linenoise.h b/linenoise.h
index b1d0a80..3138c1f 100644
--- a/linenoise.h
+++ b/linenoise.h
@@ -57,6 +57,7 @@
 void linenoiseAddCompletion(linenoiseCompletions *, const char *);
 
 char *linenoise(const char *prompt);
+void linenoiseFree(void *ptr);
 int linenoiseHistoryAdd(const char *line);
 int linenoiseHistorySetMaxLen(int len);
 int linenoiseHistorySave(const char *filename);