Skip to content

Commit

Permalink
Fix a memory leak in Undo log.
Browse files Browse the repository at this point in the history
  • Loading branch information
linmagit committed Nov 2, 2015
1 parent 6c4c67c commit f77f8d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/ee/storage/PersistentTableUndoUpdateAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <storage/PersistentTableUndoUpdateAction.h>
#include <cassert>
#include "common/StringRef.h"

namespace voltdb {

Expand Down Expand Up @@ -64,10 +65,11 @@ void PersistentTableUndoUpdateAction::release() {
/*
* Free the strings from the old tuple that were updated.
*/
for (std::vector<const char*>::iterator i = oldUninlineableColumns.begin();
for (std::vector<char*>::iterator i = oldUninlineableColumns.begin();
i != oldUninlineableColumns.end(); i++)
{
delete [] (*i);
StringRef::destroy((StringRef*)(*i));
//delete [] (*i);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ee/storage/PersistentTableUndoUpdateAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PersistentTableUndoUpdateAction: public voltdb::UndoAction {
if (uninlineableObjectColumnCount > 0) {
for (uint16_t ii = 0; ii < uninlineableObjectColumnCount; ii++) {
const uint16_t uninlineableObjectColumn = schema->getUninlinedObjectColumnInfoIndex(ii);
const char *mPtr = *reinterpret_cast<char* const*>
char *mPtr = *reinterpret_cast<char**>
(m_oldTuple.getDataPtr(uninlineableObjectColumn));
const char *oPtr = *reinterpret_cast<char* const*>
(m_newTuple.getDataPtr(uninlineableObjectColumn));
Expand Down Expand Up @@ -115,7 +115,7 @@ class PersistentTableUndoUpdateAction: public voltdb::UndoAction {
voltdb::TableTuple m_oldTuple;
voltdb::TableTuple m_newTuple;
voltdb::PersistentTable *m_table;
std::vector<const char*> oldUninlineableColumns;
std::vector<char*> oldUninlineableColumns;
std::vector<const char*> newUninlineableColumns;
bool m_revertIndexes;
size_t m_wrapperOffset;
Expand Down

0 comments on commit f77f8d0

Please sign in to comment.