Todd Lipcon has submitted this change and it was merged.

Change subject: Prevent possible memory leak in TabletServiceImpl
......................................................................


Prevent possible memory leak in TabletServiceImpl

When we allocate a WriteTransactionState in TabletServiceImpl::Write()
we would do so on the heap, but without assigning it to a smart pointer.
Then, right after that, we check that can update the clock and return an
error to the user if we can't. If we returned an error WriteTransctionState
would leak.

This changes the allocation statement to be made closer to where it is
used, after the clock is updated. This also makes it use a smart pointer
(unique_ptr) there and wherever else required. Finally this changes
AlterSchemaTransactionState to use the same smart pointer, for consistency.

Change-Id: I97181d59ea7e2d34067ad1c72edda2d6fc7360d5
Reviewed-on: http://gerrit.cloudera.org:8080/3082
Tested-by: David Ribeiro Alves <[email protected]>
Reviewed-by: Todd Lipcon <[email protected]>
---
M src/kudu/master/sys_catalog.cc
M src/kudu/tablet/tablet_peer-test.cc
M src/kudu/tablet/tablet_peer.cc
M src/kudu/tablet/tablet_peer.h
M src/kudu/tablet/transactions/alter_schema_transaction.cc
M src/kudu/tablet/transactions/alter_schema_transaction.h
M src/kudu/tablet/transactions/write_transaction.cc
M src/kudu/tablet/transactions/write_transaction.h
M src/kudu/tserver/remote_bootstrap_session-test.cc
M src/kudu/tserver/tablet_service.cc
10 files changed, 57 insertions(+), 38 deletions(-)

Approvals:
  David Ribeiro Alves: Verified
  Todd Lipcon: Looks good to me, approved



-- 
To view, visit http://gerrit.cloudera.org:8080/3082
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I97181d59ea7e2d34067ad1c72edda2d6fc7360d5
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: David Ribeiro Alves <[email protected]>
Gerrit-Reviewer: David Ribeiro Alves <[email protected]>
Gerrit-Reviewer: Todd Lipcon <[email protected]>

Reply via email to