From dd1d8fe4de9b0795bf58700e9cf54a887ddbd0dc Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 18 Feb 2020 23:26:45 +0100 Subject: [PATCH] sys: fix uninitialised memory in File class. --- src/sys/file.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/sys/file.cpp b/src/sys/file.cpp index a92ad915..9c7ef004 100644 --- a/src/sys/file.cpp +++ b/src/sys/file.cpp @@ -46,11 +46,6 @@ class FileData { friend class File; - FileData() - : m_refcount(0), - m_type(StreamType::File) - { } - void Open(StreamType stream) { if (m_type == StreamType::File || @@ -211,12 +206,12 @@ class FileData //----------------------- #if __ANDROID__ - AAsset *m_asset; + AAsset *m_asset = nullptr; #elif HAVE_STDIO_H - FILE *m_fd; + FILE *m_fd = nullptr; #endif - std::atomic m_refcount; - StreamType m_type; + std::atomic m_refcount = 0; + StreamType m_type = StreamType::File; struct stat m_stat; };