[insight-vmi] r2008 committed - forgot on internal change: Do not leak memory on page verification

0 views
Skip to first unread message

insig...@googlecode.com

unread,
Nov 8, 2013, 6:00:53 AM11/8/13
to insight-v...@googlegroups.com
Revision: 2008
Author: kit...@gmail.com
Date: Fri Nov 8 11:00:32 2013 UTC
Log: forgot on internal change: Do not leak memory on page verification
http://code.google.com/p/insight-vmi/source/detail?r=2008

Modified:
/trunk/libinsight/detect.cpp

=======================================
--- /trunk/libinsight/detect.cpp Fri Nov 8 10:30:40 2013 UTC
+++ /trunk/libinsight/detect.cpp Fri Nov 8 11:00:32 2013 UTC
@@ -53,6 +53,10 @@
std::cout << "\t VSYSCALL: " << std::hex <<
_vsyscall_page << std::dec << std::endl;
}
}
+
+Detect::~Detect(){
+ delete Functions;
+}

#define GENERIC_NOP1 0x90

@@ -1179,6 +1183,8 @@
//the entry type is 0 for disable and 1 for enable

bool doPrint = false;
+ bool addJumpEntries = false;
+ if(_jumpEntries.size() == 0) addJumpEntries = true;

quint32 numberOfJumpEntries = 0;
quint64 textSegmentInMem = 0;
@@ -1240,7 +1246,7 @@
if(doPrint) Console::out() << " " <<
((enabled) ? "enabled" : "disabled") << endl;

qint32 destination = entry->target - (entry->code + 5);
- _jumpEntries.insert(patchOffset, destination);
+ if(addJumpEntries)_jumpEntries.insert(patchOffset,
destination);


if(enabled)
@@ -1471,6 +1477,12 @@
}
}

+
+ //Save the jump_labels section for later reference.
+
+ info = findElfSegmentWithName(fileContent, "__jump_table");
+ if(info.index != 0) context.jumpTable.append(info.index, info.size);
+
updateKernelModule(context);

//Initialize the symTable in the context for later reference
@@ -1520,11 +1532,6 @@
SegmentInfo info = findElfSegmentWithName(fileContent, "__mcount_loc");
applyMcount(info, context, context.textSegmentContent);

- //Save the jump_labels section for later reference.
-
- info = findElfSegmentWithName(fileContent, "__jump_table");
- if(info.index != 0) context.jumpTable.append(info.index, info.size);
-
applyJumpEntries(context.textSegmentContent, context);

//Console::out() << "The Module got " << textSegmentContent.size() /
PAGE_SIZE << " pages." << endl;
@@ -3074,6 +3081,8 @@
PageVerifier pageVerifier = PageVerifier(_sym);
pageVerifier.verifyHashes(currentHashes);

+ delete currentHashes;
+
pageVerifier.verifyParavirtFuncs();

// Verify function pointers?
Reply all
Reply to author
Forward
0 new messages