Added logic to free up dynamic memory used by dspThread.c