contrib/fuzz/manifest.cc
changeset 40101 ca4a32d0a4d6
parent 40090 3418f83c8874
child 40146 adfe4bb53a47
--- a/contrib/fuzz/manifest.cc	Tue Oct 09 07:42:05 2018 +0900
+++ b/contrib/fuzz/manifest.cc	Tue Oct 09 07:46:01 2018 +0900
@@ -47,8 +47,8 @@
 	PyCodeObject *code =
 	    (PyCodeObject *)Py_CompileString(R"py(
 from parsers import lazymanifest
-lm = lazymanifest(mdata)
 try:
+  lm = lazymanifest(mdata)
   # iterate the whole thing, which causes the code to fully parse
   # every line in the manifest
   list(lm.iterentries())
@@ -65,7 +65,11 @@
   # print e
 )py",
 	                                     "fuzzer", Py_file_input);
-	PyEval_EvalCode(code, globals, locals);
+	PyObject *res = PyEval_EvalCode(code, globals, locals);
+	if (!res) {
+		PyErr_Print();
+	}
+	Py_XDECREF(res);
 	Py_DECREF(code);
 	Py_DECREF(locals);
 	Py_DECREF(mtext);