Skip to content

Commit

Permalink
Fix uninitialized variable append_ in class constructors.
Browse files Browse the repository at this point in the history
b/219048469
  • Loading branch information
alexanderbobrovnik committed Jan 25, 2024
1 parent 79920bc commit 6330d1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion base/files/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ File::File(File&& other)
tracing_path_(other.tracing_path_),
error_details_(other.error_details()),
created_(other.created()),
async_(other.async_) {}
async_(other.async_)
#if defined(STARBOARD)
,
append_(other.append_)
#endif
{
}

File::~File() {
// Go through the AssertIOAllowed logic.
Expand All @@ -78,6 +84,9 @@ File& File::operator=(File&& other) {
error_details_ = other.error_details();
created_ = other.created();
async_ = other.async_;
#if defined(STARBOARD)
append_ = other.append_;
#endif
return *this;
}

Expand Down
2 changes: 1 addition & 1 deletion base/files/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class BASE_EXPORT File {
bool async_;

#if defined(STARBOARD)
bool append_;
bool append_ = false;
#endif

DISALLOW_COPY_AND_ASSIGN(File);
Expand Down

0 comments on commit 6330d1f

Please sign in to comment.