Fix use-after-free and double free (#3, fixes #10)
Fix use-after-free and double free (#3, fixes #10)

f8d6f13f introduced a use-after-free and double free bugs when a stream
is reset. The stack is freed, but the old pointer is left in place and
re-used after passing a check against NULL.

Rather than free the stack on a reset, stack_top is reset to -1 (empty).
There was a check for an empty stack by comparing the pointer to NULL.
With the stack being re-used, the appropriate way to check for an empty
stack is to look at stack_top.

skeeto/pdjson