From 41f84a8d56c00f3c95a4bf0b6027bedd7abb5b15 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 30 Jul 2010 22:20:58 -0700 Subject: [PATCH] Strfree() should call kfree() not kmem_free() Using kmem_free() results in deducting X bytes from the memory accounting when --enable-debug is set. Unfortunately, currently the counterpart kmem_asprintf() and friends do not properly account for memory allocated, so we must do the same on free. If we don't then we end up with a negative number of lost bytes reported when the module is unloaded. A better long term fix would be to add the accounting in to the allocation side but that's a project for another day. --- module/spl/spl-kmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index ec1ccb4ce..53aefee14 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -295,7 +295,7 @@ EXPORT_SYMBOL(strdup); void strfree(char *str) { - kmem_free(str, strlen(str) + 1); + kfree(str); } EXPORT_SYMBOL(strfree); -- 2.40.0