A memory leak vulnerability in the Linux kernel's btrfs filesystem was fixed. The function btrfs_add_qgroup_relation fails to free a preallocated memory structure when called with invalid qgroup levels, causing a memory leak. This leak can be triggered repeatedly by an unprivileged user with write access to a btrfs mount, potentially exhausting kernel memory. The fix ensures the preallocated memory is freed on all error paths.