MB-21568: Don't double-free newdb if rewind_db_header fails 80/70080/3
authorDave Rigby <daver@couchbase.com>
Fri, 18 Nov 2016 12:31:19 +0000 (12:31 +0000)
committerDave Rigby <daver@couchbase.com>
Fri, 18 Nov 2016 15:08:00 +0000 (15:08 +0000)
commitf0612cf495d7b8bb22733c58feb34ed29932532f
tree0b78876f1752b84803545368b7fe9e327f3f5aa2
parent6aaef175782b1f6d44507ee6b2ee73fce69cb5f6
MB-21568: Don't double-free newdb if rewind_db_header fails

If couchstore_rewind_db_header() fails, then it will free the DB
before returning, so we need to ensure that the DbHolder doesn't cause
a double-free by also trying to free the Db.

Found during merge to master where we have improved couchstore testing
(CouchKVStoreErrorInjectionTest)

Change-Id: I49ba9e7e91eb73aaae90ef8aa8b41f56bbe056c9
Reviewed-on: http://review.couchbase.org/70080
Reviewed-by: Jim Walker <jim@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
src/couch-kvstore/couch-kvstore.cc
src/couch-kvstore/couch-kvstore.h