Bug Summary

File:/tmp/pyrefcon/scipy/scipy/integrate/_quadpackmodule.c
Warning:line 33, column 9
PyObject ownership leak with reference count of 1

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name _quadpackmodule.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -analyzer-output=html -analyzer-checker=python -analyzer-disable-checker=deadcode -analyzer-config prune-paths=true,suppress-c++-stdlib=true,suppress-null-return-paths=false,crosscheck-with-z3=true,model-path=/opt/pyrefcon/lib/pyrefcon/models/models -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=/tmp/pyrefcon/scipy/csa-scan,ctu-index-name=/tmp/pyrefcon/scipy/csa-scan/externalDefMap.txt,ctu-invocation-list=/tmp/pyrefcon/scipy/csa-scan/invocations.yaml,display-ctu-progress=false -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -fcoverage-compilation-dir=/tmp/pyrefcon/scipy -resource-dir /opt/pyrefcon/lib/clang/13.0.0 -isystem /opt/pyrefcon/lib/pyrefcon/models/python3.8 -D NDEBUG -D _FORTIFY_SOURCE=2 -D NO_ATLAS_INFO=1 -D HAVE_CBLAS -I scipy/_lib/src -I /usr/local/include -I /usr/include -I /usr/lib/python3/dist-packages/numpy/core/include -internal-isystem /opt/pyrefcon/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-result -Wsign-compare -Wall -Wformat -Werror=format-security -Wformat -Werror=format-security -Wdate-time -fdebug-compilation-dir=/tmp/pyrefcon/scipy -ferror-limit 19 -fwrapv -pthread -stack-protector 2 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/pyrefcon/scipy/csa-scan/reports -x c scipy/integrate/_quadpackmodule.c

scipy/integrate/_quadpackmodule.c

1/*
2 From Multipack project
3 */
4#include "__quadpack.h"
5
6static struct PyMethodDef quadpack_module_methods[] = {
7{"_qagse", quadpack_qagse, METH_VARARGS0x0001, doc_qagse},
8{"_qagie", quadpack_qagie, METH_VARARGS0x0001, doc_qagie},
9{"_qagpe", quadpack_qagpe, METH_VARARGS0x0001, doc_qagpe},
10{"_qawoe", quadpack_qawoe, METH_VARARGS0x0001, doc_qawoe},
11{"_qawfe", quadpack_qawfe, METH_VARARGS0x0001, doc_qawfe},
12{"_qawse", quadpack_qawse, METH_VARARGS0x0001, doc_qawse},
13{"_qawce", quadpack_qawce, METH_VARARGS0x0001, doc_qawce},
14{NULL((void*)0), NULL((void*)0), 0, NULL((void*)0)}
15};
16
17static struct PyModuleDef moduledef = {
18 PyModuleDef_HEAD_INIT{ { 1, ((void*)0) }, ((void*)0), 0, ((void*)0), },
19 "_quadpack",
20 NULL((void*)0),
21 -1,
22 quadpack_module_methods,
23 NULL((void*)0),
24 NULL((void*)0),
25 NULL((void*)0),
26 NULL((void*)0)
27};
28
29PyObject *PyInit__quadpack(void)
30{
31 PyObject *m, *d, *s;
32
33 m = PyModule_Create(&moduledef)PyModule_Create2(&moduledef, 1013);
1
Calling 'PyModule_Create2'
3
Returning from 'PyModule_Create2'
5
PyObject ownership leak with reference count of 1
34 import_array(){if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(
PyExc_ImportError, "numpy.core.multiarray failed to import");
return ((void*)0); } }
;
4
Taking true branch
35 d = PyModule_GetDict(m);
36
37 s = PyUnicode_FromString(" 1.13 ");
38 PyDict_SetItemString(d, "__version__", s);
39 quadpack_error = PyErr_NewException ("quadpack.error", NULL((void*)0), NULL((void*)0));
40 Py_DECREF(s)_Py_DECREF(((PyObject*)(s)));
41 PyDict_SetItemString(d, "error", quadpack_error);
42 if (PyErr_Occurred()) {
43 Py_FatalError("can't initialize module quadpack");
44 }
45 return m;
46}

/opt/pyrefcon/lib/pyrefcon/models/models/PyModule_Create2.model

1#ifndef PyModule_Create2
2struct _object;
3typedef struct _object PyObject;
4PyObject* clang_analyzer_PyObject_New_Reference();
5PyObject* PyModule_Create2(PyModuleDef *def, int module_api_version) {
6 return clang_analyzer_PyObject_New_Reference();
2
Setting reference count to 1
7}
8#else
9#warning "API PyModule_Create2 is defined as a macro."
10#endif