]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth3: Put "module_name" on the stack
authorVolker Lendecke <vl@samba.org>
Wed, 1 Jul 2026 15:03:17 +0000 (17:03 +0200)
committerAnoop C S <anoopcs@samba.org>
Fri, 3 Jul 2026 04:47:29 +0000 (04:47 +0000)
Avoid having to do a SAFE_FREE

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/auth/auth.c

index 5dd8dba6a49396e7579df022f5144e96eaac0f6b..a8e93ffe44648d3b4c9192a16369cec6716c35d9 100644 (file)
@@ -422,7 +422,7 @@ static bool load_auth_module(
        static bool initialised_static_modules = False;
 
        struct auth_init_function_entry *entry;
-       char *module_name = smb_xstrdup(module);
+       char module_name[strlen(module) + 1];
        char *module_params = NULL;
        char *p;
        bool good = False;
@@ -436,6 +436,8 @@ static bool load_auth_module(
        DEBUG(5,("load_auth_module: Attempting to find an auth method to match %s\n",
                 module));
 
+       memcpy(module_name, module, sizeof(module_name));
+
        p = strchr(module_name, ':');
        if (p) {
                *p = 0;
@@ -466,7 +468,6 @@ static bool load_auth_module(
                DEBUG(0,("load_auth_module: can't find auth method %s!\n", module_name));
        }
 
-       SAFE_FREE(module_name);
        return good;
 }