From 8ca0e79bd07e36d53c71340caf3a9adbe6a990ec Mon Sep 17 00:00:00 2001 From: Siu Kwan Lam Date: Mon, 7 Jan 2013 15:14:46 -0600 Subject: [PATCH] Fix free/delete mismatch in LLVMGetBitcodeFromModule --- llvm/_core.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/_core.cpp b/llvm/_core.cpp index 5440960..e5c309c 100644 --- a/llvm/_core.cpp +++ b/llvm/_core.cpp @@ -226,12 +226,12 @@ _wLLVMGetBitcodeFromModule(PyObject *self, PyObject *args) if (!m ) return NULL; size_t len; - unsigned const char *ubytes = LLVMGetBitcodeFromModule(m, &len) ; + const unsigned char *ubytes = LLVMGetBitcodeFromModule(m, &len) ; if ( !ubytes ) Py_RETURN_NONE; const char *chars = reinterpret_cast(ubytes) ; PyObject *ret = PyBytes_FromStringAndSize(chars, len); - LLVMDisposeMessage(const_cast(chars)); + delete [] ubytes; return ret; LLVMPY_CATCH_ALL }