MB-7764 Don't crash if reduce function calls emit()

If a reduce function called emit(), a danling pointer
was being derreferenced, which lead to a crash.

Change-Id: I3d63ae86e3a4c1027637235210fbd6dc101dc7ac
Reviewed-on: http://review.couchbase.org/24648
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>