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

index 68dd0b8d5046b043b89d50309d223d8f82c9e162..fd91bfe3d2b0daee2c61204f654cdc0c9890f56b 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,12 +709,14 @@ 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->user,
                        conn->connectpath, conn->gid,
                        get_current_username(),
                        current_user_info.domain,
                        prefix);
+       TALLOC_FREE(prefix);
+       return result;
 }
 
 static bool log_success(vfs_handle_struct *handle, vfs_op_type op)