diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-10-17 15:35:28 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-10-17 15:35:28 +0400 |
commit | dd662e9b585405b3eb1856d8188fe8c6d74ce1c7 (patch) | |
tree | 1722d634281455face0351c32cfbc8b41a5756f0 /OnDiskPt | |
parent | 4cf1ffb7d803710a2a2bbaab84c42e42b1b175a1 (diff) |
Heap->Stack variable
Diffstat (limited to 'OnDiskPt')
-rw-r--r-- | OnDiskPt/Word.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/OnDiskPt/Word.cpp b/OnDiskPt/Word.cpp index 52e49d8d9..e64de43af 100644 --- a/OnDiskPt/Word.cpp +++ b/OnDiskPt/Word.cpp @@ -86,15 +86,14 @@ size_t Word::ReadFromMemory(const char *mem) size_t Word::ReadFromFile(std::fstream &file) { - size_t memAlloc = sizeof(UINT64) + sizeof(char); - char *mem = (char*) malloc(memAlloc); + const size_t memAlloc = sizeof(UINT64) + sizeof(char); + char mem[sizeof(UINT64) + sizeof(char)]; file.read(mem, memAlloc); size_t memUsed = ReadFromMemory(mem); CHECK(memAlloc == memUsed); - free(mem); - return memUsed; + return memAlloc; } void Word::ConvertToMoses( |