File: src/_imagingft.c
Function: setup_module
Error: memory leak: ob_refcnt of new ref from (unknown) PyUnicode_FromFormat is 1 too high
1334 static int
1335 setup_module(PyObject *m) {
1336     PyObject *d;
1337     PyObject *v;
1338     int major, minor, patch;
1339 
1340     d = PyModule_GetDict(m);
1341 
1342     /* Ready object type */
1343     PyType_Ready(&Font_Type);
when PyType_Ready() succeeds
1344 
1345     if (FT_Init_FreeType(&library)) {
when considering value == (FT_Error)0 from src/_imagingft.c:1345
taking False path
1346         return 0; /* leave it uninitialized */
1347     }
1348 
1349     FT_Library_Version(library, &major, &minor, &patch);
1350 
1351     v = PyUnicode_FromFormat("%d.%d.%d", major, minor, patch);
when PyUnicode_FromFormat() succeeds
new ref from (unknown) PyUnicode_FromFormat was allocated at:     v = PyUnicode_FromFormat("%d.%d.%d", major, minor, patch);
ob_refcnt is now refs: 1 owned
1352     PyDict_SetItemString(d, "freetype2_version", v);
when PyDict_SetItemString() succeeds
ob_refcnt is now refs: 1 owned, 1 borrowed
1353 
1354 #ifdef HAVE_RAQM
1355 #if defined(HAVE_RAQM_SYSTEM) || defined(HAVE_FRIBIDI_SYSTEM)
1356     have_raqm = 1;
1357 #else
1358     load_fribidi();
1359     have_raqm = !!p_fribidi;
1360 #endif
1361 #else
1362     have_raqm = 0;
1363 #endif
1364 
1365     /* if we have Raqm, we have all three (but possibly no version info) */
1366     v = PyBool_FromLong(have_raqm);
PyBool_FromLong() returns
1367     PyDict_SetItemString(d, "HAVE_RAQM", v);
when PyDict_SetItemString() succeeds
1368     PyDict_SetItemString(d, "HAVE_FRIBIDI", v);
when PyDict_SetItemString() fails
1369     PyDict_SetItemString(d, "HAVE_HARFBUZZ", v);
when PyDict_SetItemString() fails
1370     if (have_raqm) {
taking True path
1371 #ifdef RAQM_VERSION_MAJOR
1372         v = PyUnicode_FromString(raqm_version_string());
1373 #else
1374         v = Py_None;
1375 #endif
1376         PyDict_SetItemString(d, "raqm_version", v);
when PyDict_SetItemString() succeeds
1377 
1378 #ifdef FRIBIDI_MAJOR_VERSION
1379         {
1380             const char *a = strchr(fribidi_version_info, ')');
1381             const char *b = strchr(fribidi_version_info, '\n');
1382             if (a && b && a + 2 < b) {
1383                 v = PyUnicode_FromStringAndSize(a + 2, b - (a + 2));
1384             } else {
1385                 v = Py_None;
1386             }
1387         }
1388 #else
1389         v = Py_None;
1390 #endif
1391         PyDict_SetItemString(d, "fribidi_version", v);
when PyDict_SetItemString() succeeds
1392 
1393 #ifdef HB_VERSION_STRING
1394         v = PyUnicode_FromString(hb_version_string());
1395 #else
1396         v = Py_None;
1397 #endif
1398         PyDict_SetItemString(d, "harfbuzz_version", v);
when PyDict_SetItemString() succeeds
1399     }
1400 
1401     return 0;
1402 }

File: src/_imagingft.c
Function: setup_module
Error: memory leak: ob_refcnt of PyBool_FromLong is 1 too high
1334 static int
1335 setup_module(PyObject *m) {
1336     PyObject *d;
1337     PyObject *v;
1338     int major, minor, patch;
1339 
1340     d = PyModule_GetDict(m);
1341 
1342     /* Ready object type */
1343     PyType_Ready(&Font_Type);
when PyType_Ready() succeeds
1344 
1345     if (FT_Init_FreeType(&library)) {
when considering value == (FT_Error)0 from src/_imagingft.c:1345
taking False path
1346         return 0; /* leave it uninitialized */
1347     }
1348 
1349     FT_Library_Version(library, &major, &minor, &patch);
1350 
1351     v = PyUnicode_FromFormat("%d.%d.%d", major, minor, patch);
when PyUnicode_FromFormat() succeeds
1352     PyDict_SetItemString(d, "freetype2_version", v);
when PyDict_SetItemString() succeeds
1353 
1354 #ifdef HAVE_RAQM
1355 #if defined(HAVE_RAQM_SYSTEM) || defined(HAVE_FRIBIDI_SYSTEM)
1356     have_raqm = 1;
1357 #else
1358     load_fribidi();
1359     have_raqm = !!p_fribidi;
1360 #endif
1361 #else
1362     have_raqm = 0;
1363 #endif
1364 
1365     /* if we have Raqm, we have all three (but possibly no version info) */
1366     v = PyBool_FromLong(have_raqm);
PyBool_FromLong() returns
PyBool_FromLong was allocated at:     v = PyBool_FromLong(have_raqm);
ob_refcnt is now refs: 1 owned
1367     PyDict_SetItemString(d, "HAVE_RAQM", v);
when PyDict_SetItemString() succeeds
ob_refcnt is now refs: 1 owned, 1 borrowed
1368     PyDict_SetItemString(d, "HAVE_FRIBIDI", v);
when PyDict_SetItemString() fails
1369     PyDict_SetItemString(d, "HAVE_HARFBUZZ", v);
when PyDict_SetItemString() fails
1370     if (have_raqm) {
taking True path
1371 #ifdef RAQM_VERSION_MAJOR
1372         v = PyUnicode_FromString(raqm_version_string());
1373 #else
1374         v = Py_None;
1375 #endif
1376         PyDict_SetItemString(d, "raqm_version", v);
when PyDict_SetItemString() succeeds
1377 
1378 #ifdef FRIBIDI_MAJOR_VERSION
1379         {
1380             const char *a = strchr(fribidi_version_info, ')');
1381             const char *b = strchr(fribidi_version_info, '\n');
1382             if (a && b && a + 2 < b) {
1383                 v = PyUnicode_FromStringAndSize(a + 2, b - (a + 2));
1384             } else {
1385                 v = Py_None;
1386             }
1387         }
1388 #else
1389         v = Py_None;
1390 #endif
1391         PyDict_SetItemString(d, "fribidi_version", v);
when PyDict_SetItemString() succeeds
1392 
1393 #ifdef HB_VERSION_STRING
1394         v = PyUnicode_FromString(hb_version_string());
1395 #else
1396         v = Py_None;
1397 #endif
1398         PyDict_SetItemString(d, "harfbuzz_version", v);
when PyDict_SetItemString() succeeds
1399     }
1400 
1401     return 0;
1402 }