Fix refcount unit test.

Turns out that it is allowed to destroy a refcount without attaching
to it first.
Merge pull request #693 from kacfengine/memFixes

Fix refcount unit test.