summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Utility/libunwind/src/AssemblyParser.hpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-07-02 23:23:14 +0000
committerGreg Clayton <gclayton@apple.com>2010-07-02 23:23:14 +0000
commit13a177aeb89ba167a440207f965eb2788922d2a9 (patch)
tree61d0bfbf09ac69d61aa4e294b7991b518a3abff4 /lldb/source/Plugins/Process/Utility/libunwind/src/AssemblyParser.hpp
parent3770af58520212f1fba3474a7e2e3f79d8c762aa (diff)
downloadbcm5719-llvm-13a177aeb89ba167a440207f965eb2788922d2a9.tar.gz
bcm5719-llvm-13a177aeb89ba167a440207f965eb2788922d2a9.zip
Plugged 4 more leaks in the libunwind code. One leaks is still left in as it
is quite gnarly code and there is no good way to clean it up. I will have Jason look at a fix for this. llvm-svn: 107539
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/libunwind/src/AssemblyParser.hpp')
-rw-r--r--lldb/source/Plugins/Process/Utility/libunwind/src/AssemblyParser.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/Utility/libunwind/src/AssemblyParser.hpp b/lldb/source/Plugins/Process/Utility/libunwind/src/AssemblyParser.hpp
index b34f93f50c6..c4425b47a0d 100644
--- a/lldb/source/Plugins/Process/Utility/libunwind/src/AssemblyParser.hpp
+++ b/lldb/source/Plugins/Process/Utility/libunwind/src/AssemblyParser.hpp
@@ -44,6 +44,8 @@ namespace lldb_private
class AssemblyParse_x86 {
public:
+ enum { kMaxInstructionByteSize = 32 };
+
AssemblyParse_x86 (RemoteProcInfo& procinfo, unw_accessors_t *acc, unw_addr_space_t as, void *arg) : fArg(arg), fAccessors(acc), fAs(as), fRemoteProcInfo(procinfo) {
fRegisterMap = fRemoteProcInfo.getRegisterMap();
if (fRemoteProcInfo.getTargetArch() == UNW_TARGET_X86_64) {
@@ -76,7 +78,7 @@ public:
private:
void *fArg;
- uint8_t* fCurInsnByteBuf;
+ uint8_t fCurInsnByteBuf[kMaxInstructionByteSize];
int fCurInsnSize;
RemoteProcInfo& fRemoteProcInfo;
RemoteRegisterMap *fRegisterMap;
@@ -285,7 +287,7 @@ bool AssemblyParse_x86::profileFunction (uint64_t start, uint64_t end, RemoteUnw
/* An error parsing the instruction; stop scanning. */
break;
}
- fCurInsnByteBuf = (uint8_t *) malloc (fCurInsnSize);
+ assert (fCurInsnSize <= kMaxInstructionByteSize);
if (fRemoteProcInfo.getBytes (cur_addr, fCurInsnSize, fCurInsnByteBuf, fArg) == 0)
return false;
next_addr = cur_addr + fCurInsnSize;
OpenPOWER on IntegriCloud