\linden\indra\lscript\lscript_library\lscript_alloc.cpp
Lines 1001 -> 1051
There are a few bugs with this function that can be fixed without breaking any existing scripts.
Bug1: Memory Leak: When the lengths are not equal 'list1' & 'list2' are not released before return.
Bug2: Memory Leak: In the while loop, 'list1' & 'list2' are never released before return.
Bug3: 'count' is never incremented so zero is always returned by the while loop.
Incrementing 'count' would break existing scripts. Since the while loop always returns zero, it can be eliminated since zero is the default return at this point.
We can simplify this entire section of code by
Replacing the above mentioned lines with:
delete list1;
delete list2;
return length1 - length2;