lib/string: clear dangling pointer on String::deref

In order to make use-after-free of Strings fail more quickly, this change
blows away _r.memo on String::deref(), since we should no longer hold a
reference to it.  Additionally, it asserts that the memo_t's refcount is not
zero when deref is invoked, since the caller should have a valid reference
at that point, and also that the refcount is zero when the memo_t is
deleted.