Fixed a memory leak in cli_set_mntpoint().
authorHar Gagan Sahai <SHarGagan@novell.com>
Wed, 6 Aug 2014 09:02:35 +0000 (14:32 +0530)
committerJeremy Allison <jra@samba.org>
Wed, 13 Aug 2014 02:36:49 +0000 (04:36 +0200)
Fixes bug #10759 - Memory leak in libsmbclient in cli_set_mntpoint function

https://bugzilla.samba.org/show_bug.cgi?id=10759

Signed-off-by: Har Gagan Sahai <SHarGagan@novell.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug 13 04:36:50 CEST 2014 on sn-devel-104

source3/libsmb/clidfs.c

index 80fba23f67bb376c147a52055d2b7dfe9454541e..93f04c50746b549aa48133eb54d454412175a13d 100644 (file)
@@ -280,13 +280,15 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 
 static void cli_set_mntpoint(struct cli_state *cli, const char *mnt)
 {
-       char *name = clean_name(NULL, mnt);
+       TALLOC_CTX *frame = talloc_stackframe();
+       char *name = clean_name(frame, mnt);
        if (!name) {
+               TALLOC_FREE(frame);
                return;
        }
        TALLOC_FREE(cli->dfs_mountpoint);
        cli->dfs_mountpoint = talloc_strdup(cli, name);
-       TALLOC_FREE(name);
+       TALLOC_FREE(frame);
 }
 
 /********************************************************************