Fix a bad memleak in vfs_full_audit
authorVolker Lendecke <vl@samba.org>
Mon, 5 Jan 2009 12:41:39 +0000 (13:41 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 5 Jan 2009 12:41:42 +0000 (13:41 +0100)
source/modules/vfs_full_audit.c

index 5028c621e74024caf9fef2cf7dfb9e1cf333dcd3..30da8bde5f42e5a0ef090123bf9d4b1f47e5b085 100644 (file)
@@ -701,6 +701,7 @@ static int audit_syslog_priority(vfs_handle_struct *handle)
 static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
 {
        char *prefix = NULL;
+       char *result;
 
        prefix = talloc_strdup(ctx,
                        lp_parm_const_string(SNUM(conn), "full_audit",
@@ -708,7 +709,7 @@ static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
        if (!prefix) {
                return NULL;
        }
-       return talloc_sub_advanced(ctx,
+       result = talloc_sub_advanced(ctx,
                        lp_servicename(SNUM(conn)),
                        conn->server_info->unix_name,
                        conn->connectpath,
@@ -716,6 +717,8 @@ static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
                        conn->server_info->sanitized_username,
                        pdb_get_domain(conn->server_info->sam_account),
                        prefix);
+       TALLOC_FREE(prefix);
+       return result;
 }
 
 static bool log_success(vfs_handle_struct *handle, vfs_op_type op)