Updated test case expected output to add offsetGet() calls
Fixed memory leak