Bug Summary

File:/tmp/pyrefcon/scipy/scipy/optimize/_minpackmodule.c
Warning:line 32, 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 _minpackmodule.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 NPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION -I scipy/_lib/src -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/optimize/_minpackmodule.c

scipy/optimize/_minpackmodule.c

1/*
2 Multipack project.
3 This file is generated by setmodules.py. Do not modify it.
4 */
5#include "minpack.h"
6static PyObject *minpack_error;
7#include "__minpack.h"
8static struct PyMethodDef minpack_module_methods[] = {
9{"_hybrd", minpack_hybrd, METH_VARARGS0x0001, doc_hybrd},
10{"_hybrj", minpack_hybrj, METH_VARARGS0x0001, doc_hybrj},
11{"_lmdif", minpack_lmdif, METH_VARARGS0x0001, doc_lmdif},
12{"_lmder", minpack_lmder, METH_VARARGS0x0001, doc_lmder},
13{"_chkder", minpack_chkder, METH_VARARGS0x0001, doc_chkder},
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 "_minpack",
20 NULL((void*)0),
21 -1,
22 minpack_module_methods,
23 NULL((void*)0),
24 NULL((void*)0),
25 NULL((void*)0),
26 NULL((void*)0)
27};
28PyObject *PyInit__minpack(void)
29{
30 PyObject *m, *d, *s;
31
32 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
33 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
34
35 d = PyModule_GetDict(m);
36
37 s = PyUnicode_FromString(" 1.10 ");
38 PyDict_SetItemString(d, "__version__", s);
39 Py_DECREF(s)_Py_DECREF(((PyObject*)(s)));
40 minpack_error = PyErr_NewException ("minpack.error", NULL((void*)0), NULL((void*)0));
41 PyDict_SetItemString(d, "error", minpack_error);
42 if (PyErr_Occurred())
43 Py_FatalError("can't initialize module minpack");
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