Commit 6a843b6
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, since T is always a concrete type. This ensures only one
move occurs and avoids lifetime violations that can lead to tag mismatches
under HWASAN.
Differential Revision: D762713591 parent 8f05c35 commit 6a843b6
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