Scripts/Shadowmoon Valley: Fix static analysis issues added in cd48ee01c0b1465c5b07427bb6fe9baa57f053b9

Fix static analysis issues added in cd48ee01c0b1465c5b07427bb6fe9baa57f053b9 about uninitialized values and pointers possibly point to free'd memory being dereferenced.
In memory of all the developers who got banned from IRC in the process of fixing these issues.