Fixed a pointer ownership bug in Master::removeFramework.
Fixed a pointer ownership bug in Master::removeFramework.

Previously, the framework being removed was pushed back to the circular
buffer of completed frameworks as a shared_ptr halfway through the
computation done to remove a framework from the master. The pointer to
the framework was then accessed again after this point.

Pushing a shared_ptr this way is fine so long as the push_pack succeeds
and the pointer is actually inserted into the buffer. However, with the
introduction of the new flags to set the size of this buffer via
max_completed_frameworks, it's possible for the size of this buffer to
be 0. As such, the circular buffer was taking control of the pointer,
noticing there was nowhere to push it, and then freeing it.  This causes
problems since the pointer is then accessed later on.

This patch moves the insertion of the shared pointer into the circular
buffer to the end of the removeFramework() call. This change should not
have any adverse effects.

Review: https://reviews.apache.org/r/42154

jpeach/mesos,Gilbert88/mesos,chhsia0/mesos,verizonlabs/mesos,Aman-Jain-14/customizedMesos,yuquanshan/customizedMesos,gsantovena/mesos,verizonlabs/mesos,craimbert/mesos,neilconway/mesos,zmalik/mesos,abudnik/mesos,dforsyth/mesos,gsantovena/mesos,zmalik/mesos,kaysoky/mesos,dforsyth/mesos,craimbert/mesos,yuquanshan/customizedMesos,reneploetz/mesos,zmalik/mesos,chhsia0/mesos,abudnik/mesos,Gilbert88/mesos,zmalik/mesos,craimbert/mesos,abudnik/mesos,jpeach/mesos,gsantovena/mesos,dforsyth/mesos,yuquanshan/customizedMesos,yuquanshan/customizedMesos,Aman-Jain-14/customizedMesos,abudnik/mesos,andschwa/mesos,andschwa/mesos,neilconway/mesos,Aman-Jain-14/customizedMesos,Gilbert88/mesos,andschwa/mesos,Gilbert88/mesos,dforsyth/mesos,zmalik/mesos,Aman-Jain-14/customizedMesos,craimbert/mesos,abudnik/mesos,kaysoky/mesos,reneploetz/mesos,craimbert/mesos,reneploetz/mesos,asamerh4/mesos,asamerh4/mesos,reneploetz/mesos,gsantovena/mesos,neilconway/mesos,jpeach/mesos,yuquanshan/customizedMesos,neilconway/mesos,Aman-Jain-14/customizedMesos,Gilbert88/mesos,verizonlabs/mesos,chhsia0/mesos,gsantovena/mesos,verizonlabs/mesos,gsantovena/mesos,andschwa/mesos,asamerh4/mesos,reneploetz/mesos,chhsia0/mesos,kaysoky/mesos,yuquanshan/customizedMesos,asamerh4/mesos,neilconway/mesos,chhsia0/mesos,zmalik/mesos,jpeach/mesos,reneploetz/mesos,jpeach/mesos,reneploetz/mesos,andschwa/mesos,chhsia0/mesos,gsantovena/mesos,yuquanshan/customizedMesos,dforsyth/mesos,kaysoky/mesos,dforsyth/mesos,kaysoky/mesos,craimbert/mesos,andschwa/mesos,asamerh4/mesos,jpeach/mesos,Aman-Jain-14/customizedMesos,verizonlabs/mesos,asamerh4/mesos,chhsia0/mesos,verizonlabs/mesos,asamerh4/mesos,craimbert/mesos,kaysoky/mesos,Gilbert88/mesos,abudnik/mesos,kaysoky/mesos,Gilbert88/mesos,abudnik/mesos,verizonlabs/mesos,zmalik/mesos,neilconway/mesos,jpeach/mesos,andschwa/mesos,dforsyth/mesos,neilconway/mesos,Aman-Jain-14/customizedMesos