| 1 | diff --git a/torch/csrc/stable/stableivalue_conversions.h b/torch/csrc/stable/stableivalue_conversions.h |
| 2 | --- a/torch/csrc/stable/stableivalue_conversions.h |
| 3 | +++ b/torch/csrc/stable/stableivalue_conversions.h |
| 4 | @@ -807 +807 @@ |
| 5 | -// Returns a new std::string; the string in val is deleted. |
| 6 | +// Returns a std::string which owns its memory; the string in val is deleted. |
| 7 | @@ -819 +819 @@ |
| 8 | - auto strptr = new std::string(data, length); |
| 9 | + const auto str = std::string(data, length); |
| 10 | @@ -821 +821 @@ |
| 11 | - // delete the old string before returning new string |
| 12 | + // delete the old string |
| 13 | @@ -823 +823 @@ |
| 14 | - return *strptr; |
| 15 | + return str; |