Merge master-branch

* master:
  Correctly NUL-terminate log buffer
  tcmalloc: Only include tcmalloc tests if active allocator

Change-Id: I7b6e24c05f0673c91fbfe07a7108f4f38c04273f
Merge master-branch

* master:
  Correctly NUL-terminate log buffer
  tcmalloc: Only include tcmalloc tests if active allocator

Change-Id: Ibfb70d20cf3365597d28ef7680fadd1f43a38cdd
Reset the available read buffers if rbytes==0

If rbytes is zero then we don't need any of the previous data between
rbuf (start of read buffer) and rcurr (current position), so can reset
rcurr back to rbuf, making more read buffer available without having
to allocate more memory.

Change-Id: I5850a4de853687db84d89123335cc56141329b76
Reviewed-on: http://review.couchbase.org/38553
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
testapp: Add option to run memcached under Valgrind

Change-Id: Ice7dd44fc76a4b5771551da7a16c5dd9640750d5
Reviewed-on: http://review.couchbase.org/38558
Tested-by: Dave Rigby <daver@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
MB-11501: Client may cause server to crash in SASL

A client skipping PROTOCOL_BINARY_CMD_SASL_AUTH and going
directly to PROTOCOL_BINARY_CMD_SASL_STEP caused the server
to crash because the c->sasl_conn wasn't initialized (and
hence a NIL pointer)

Change-Id: Idecf0b63acb8befff08bcea02ea8451e1840e4b6
Reviewed-on: http://review.couchbase.org/38689
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reset auth_data when called for an invalid connection

Change-Id: Icd9d8b14e51e12348f2702f1ea60bf543a6255d6
Reviewed-on: http://review.couchbase.org/38690
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Merge remote-tracking branch 'membase/3.0'

* membase/3.0:
  Reset auth_data when called for an invalid connection
  MB-11501: Client may cause server to crash in SASL

Change-Id: I35334ea9b4619ac426a86831bb18e960f1dd003f
Merge remote-tracking branch 'membase/3.0.1'

* membase/3.0.1:
  Reset auth_data when called for an invalid connection
  MB-11501: Client may cause server to crash in SASL
  testapp: Add option to run memcached under Valgrind
  Reset the available read buffers if rbytes==0

Change-Id: I324eb6d3b00978ae9304bdf23fdb613de2685577