summaryrefslogtreecommitdiff
path: root/src/wasm-binary.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-01-28 17:23:30 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-01-28 17:23:30 -0800
commit991891ef329f099ab2927af173dc920bfe2f9234 (patch)
treea73e9324fb7df5f9ecfa671895fc17e8ac7eedd1 /src/wasm-binary.h
parent1dda2d7a26d4cf214ad723d8ea43a6dc126aa563 (diff)
downloadbinaryen-991891ef329f099ab2927af173dc920bfe2f9234.tar.gz
binaryen-991891ef329f099ab2927af173dc920bfe2f9234.tar.bz2
binaryen-991891ef329f099ab2927af173dc920bfe2f9234.zip
fix memory segment reading in binary format
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r--src/wasm-binary.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index f86a19aa8..d2959c69d 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1187,14 +1187,15 @@ public:
if (debug) std::cerr << "== readDataSegments" << std::endl;
auto num = getLEB128();
for (size_t i = 0; i < num; i++) {
- auto curr = allocator.alloc<Memory::Segment>();
- curr->offset = getInt32();
+ Memory::Segment curr;
+ curr.offset = getInt32();
auto start = getInt32();
auto size = getInt32();
auto buffer = malloc(size);
memcpy(buffer, &input[start], size);
- curr->data = (const char*)buffer;
- curr->size = size;
+ curr.data = (const char*)buffer;
+ curr.size = size;
+ wasm.memory.segments.push_back(curr);
verifyInt8(1); // load at program start
}
}