Skip to content

Instantly share code, notes, and snippets.

@eltjpm
Created February 5, 2014 22:49
Show Gist options
  • Save eltjpm/8834958 to your computer and use it in GitHub Desktop.
Save eltjpm/8834958 to your computer and use it in GitHub Desktop.
Index: llvmpy/include/llvm_binding/extra.h
===================================================================
--- llvmpy/include/llvm_binding/extra.h (revision 14593)
+++ llvmpy/include/llvm_binding/extra.h (revision 14594)
@@ -164,6 +164,7 @@
for(; begin != end; ++begin) {
PyObject* cap = pycapsule_new(&*begin, capsuleName, className);
PyList_Append(list, cap);
+ Py_DECREF(cap);
}
return list;
}
@@ -176,6 +177,7 @@
for(; begin != end; ++begin) {
PyObject* cap = pycapsule_new(*begin, capsuleName, className);
PyList_Append(list, cap);
+ Py_DECREF(cap);
}
return list;
}
@@ -545,6 +547,7 @@
if (-1 == PyFile_WriteObject(buf, Out, Py_PRINT_RAW)){
return NULL;
}
+ Py_DECREF(buf);
Py_RETURN_TRUE;
} else {
Py_RETURN_FALSE;
@@ -814,7 +817,9 @@
inline virtual void passEnumerate(const llvm::PassInfo * pass_info){
PyObject* passArg = PyString_FromString(pass_info->getPassArgument());
PyObject* passName = PyString_FromString(pass_info->getPassName());
- PyList_Append(List, Py_BuildValue("(OO)", passArg, passName));
+ PyObject* pair = Py_BuildValue("(NN)", passArg, passName);
+ PyList_Append(List, pair);
+ Py_DECREF(pair);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment