Fix some mistakes from WeakRef support

* Be sure to free the pointer, not `this.ptr` which is always 0
* Unconditionally attempt to free data and let Rust throw an exception if it's
  null
This commit is contained in:
Alex Crichton 2018-08-20 14:14:55 -07:00
parent 86d1ab513b
commit 2972599ee3

View File

@ -650,11 +650,9 @@ impl<'a> Context<'a> {
dst.push_str(&format!(
"
free() {{
if (this.ptr === 0)
return;
const ptr = this.ptr;
this.ptr = 0;
free{}(this.ptr);
free{}(ptr);
}}
",
name,