summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-04-18 10:22:55 -0700
committerGitHub <noreply@github.com>2017-04-18 10:22:55 -0700
commitddfbfc592da5c7b889de46c5a58e62de672b197c (patch)
tree317f45b5ba13f58a6adca1e8e0a7d9fc82f5b73d
parenta4751fe78f119305fa8927f1bba10aefecc14f3f (diff)
downloadwabt-ddfbfc592da5c7b889de46c5a58e62de672b197c.tar.gz
wabt-ddfbfc592da5c7b889de46c5a58e62de672b197c.tar.bz2
wabt-ddfbfc592da5c7b889de46c5a58e62de672b197c.zip
Fix uninitialized value in binary-writer-spec (#401)
-rw-r--r--src/binary-writer-spec.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc
index ed726475..d4b7f20d 100644
--- a/src/binary-writer-spec.cc
+++ b/src/binary-writer-spec.cc
@@ -31,15 +31,22 @@ namespace wabt {
namespace {
struct Context {
+ Context();
+
MemoryStream json_stream;
StringSlice source_filename;
StringSlice module_filename_noext;
- bool write_modules; /* Whether to write the modules files. */
+ bool write_modules = false; /* Whether to write the modules files. */
const WriteBinarySpecOptions* spec_options;
- Result result;
- size_t num_modules;
+ Result result = Result::Ok;
+ size_t num_modules = 0;
};
+Context::Context() {
+ WABT_ZERO_MEMORY(source_filename);
+ WABT_ZERO_MEMORY(module_filename_noext);
+}
+
} // namespace
static void convert_backslash_to_slash(char* s, size_t length) {