Commit d9e7ea4
Avoid use-after-return caused by double move
Summary:
Previously, `Result<T>`'s constructor used `std::move(val)` to initialize the
value. This resulted in an unnecessary extra move and destructor call on a
moved-from stack object, triggering an HWASAN stack tag mismatch when the
moved-from object was later destructed.
Replacing `std::move(val)` with just `val` avoids the extra move while
preserving correct semantics. This ensures only one move occurs and avoids
lifetime violations that can lead to tag mismatches under HWASAN.
Reviewed By: StefanBossbaly
Differential Revision: D762713591 parent 8f05c35 commit d9e7ea4
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
| 73 | + | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
0 commit comments