mirror of
https://github.com/AnimeThemes/animethemes-web.git
synced 2026-07-11 01:24:31 +02:00
fix: Fixed potential memory leak caused by recursive playlists (#227)
This commit is contained in:
@@ -75,6 +75,7 @@ import {
|
||||
UNSORTED,
|
||||
} from "@/utils/comparators";
|
||||
import createVideoSlug from "@/utils/createVideoSlug";
|
||||
import devLog from "@/utils/devLog";
|
||||
import type { SharedPageProps } from "@/utils/getSharedPageProps";
|
||||
import getSharedPageProps from "@/utils/getSharedPageProps";
|
||||
import type { Comparator, RequiredNonNullable } from "@/utils/types";
|
||||
@@ -163,10 +164,15 @@ function sortLinkedList<T>(list: LinkedList<T>) {
|
||||
const sortedList = [];
|
||||
|
||||
while (next) {
|
||||
delete lookUp[next.id];
|
||||
sortedList.push(next);
|
||||
next = next.next ? lookUp[next.next.id] : undefined;
|
||||
}
|
||||
|
||||
if (sortedList.length !== list.length) {
|
||||
devLog.error("The sorted linked list has a different size as the original list. It probably has broken links!");
|
||||
}
|
||||
|
||||
return sortedList;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user