Two were actual bugs, though they existed only in unused code:
* In Freestyle it was unintentionally copying a scene rather than referencing it.
* In BLI_array_store_is_valid there was use of uninitialized memory.
Don't store maximum length of text per undo step,
or attempt to pack all data in a single array.
Was storing 32766 characters per undo step, irrespective of actual text length.