SIGN IN SIGN UP

Fix EValue construction from a smart pointer. (#5357)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/5357

The move constructor invoked by `*this =` expression tries to `destroy()` the `this` first, but it's not yet initialized.

For example, if the tag is randomly `Tag::ListTensor`, `destroy()` will try to iterate over and destroy a list of tensors. But since the memory is uninitialized, it will typically crash or corrupt memory.

Reviewed By: dbort

Differential Revision: D62658327

fbshipit-source-id: a12cb48f4bc3384a80534a453909e010c9549850
A
Anthony Shoumikhin committed
0aa75e6ef444ad82daadf84f6634d58c2d36003d
Parent: 69d33a8
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 9/14/2024, 12:44:11 AM