Fix some 'dereference-before-null-check' warnings in test_circuitlist.c

Found by Coverity Scan.

[CID 1234704, 1234705, 1234706]
Fix a couple of small memory leaks on failure cases.

[CID 1234702, 1234703]