diff options
author | Paul Berry <stereotype441@gmail.com> | 2013-08-20 08:55:19 -0700 |
---|---|---|
committer | Chad Versace <chad.versace@linux.intel.com> | 2013-08-20 12:29:35 -0700 |
commit | 911b4676559d6325e798ba07a5a83d7083cf11da (patch) | |
tree | 4b133b89891a015f4fcc7d8e6af0a47f7fd8f94c | |
parent | 877f856fa9b96defae18e5479f8ddad0c4983324 (diff) |
core: Zero-initialize wcore_info struct
Without this, it's possible that the garbage memory returned by malloc
will have wcore_info::is_init == true, causing wcore_tinfo_init() to
skip initialization. That in turn causes a likely segfault the first
time wcore_info::error is accessed.
Fixes piglit crashes introduced by commit 6fcbe52 ("cmake: Refactor
compiler flags into new module").
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r-- | src/waffle/core/wcore_tinfo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/waffle/core/wcore_tinfo.c b/src/waffle/core/wcore_tinfo.c index 4184b52..43f6e61 100644 --- a/src/waffle/core/wcore_tinfo.c +++ b/src/waffle/core/wcore_tinfo.c @@ -138,7 +138,7 @@ wcore_tinfo_get(void) if (tinfo) return tinfo; - tinfo = malloc(sizeof(*tinfo)); + tinfo = calloc(1, sizeof(*tinfo)); if (!tinfo) wcore_tinfo_abort_init(); |