summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-15 13:33:41 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-16 00:46:45 +0100
commitf9422a46535a539e60776ad8df08991ca2ebdee5 (patch)
treef3241bdfbdfad8af2e33bd24612c75b6e7212d3a
parent239d62bbcfeb26aa6c29e95675e1f6907fea4c4b (diff)
clang: Don't leak all the strings in the world.
-rw-r--r--libbindgen/src/clang.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbindgen/src/clang.rs b/libbindgen/src/clang.rs
index d10457b3..15f288dd 100644
--- a/libbindgen/src/clang.rs
+++ b/libbindgen/src/clang.rs
@@ -933,7 +933,9 @@ impl Into<String> for CXString {
}
unsafe {
let c_str = CStr::from_ptr(clang_getCString(self) as *const _);
- c_str.to_string_lossy().into_owned()
+ let ret = c_str.to_string_lossy().into_owned();
+ clang_disposeString(self);
+ ret
}
}
}