SERVER-15899 BSONElementIterator::more() shouldn't overflow stack

BSONElementIterator::more() was using a stack frame per array
element traversed.

(cherry picked from commit 20c218d3d3df17c820b9cd3e6399a2dec6755d94)
SERVER-15485 CanonicalQuery::canonicalize() manage lpq with auto_ptr

(cherry picked from commit 80baa49b5dff32bc0eebdfb2ab07d057126dea8d)