Fix memory leak in changes counting code

Change-Id: I5182d947853397bcf68a2ebdf966b9d221c1f22a
Reviewed-on: http://review.couchbase.org/34369
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: buildbot <build@couchbase.com>