Skip to content

Decrement reference count #7003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PyUnicode_* may return NULL
  • Loading branch information
radarhere committed Mar 20, 2023
commit 63286622488ffaeb481f74a0c499fd8732df98e7
14 changes: 7 additions & 7 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -4213,7 +4213,7 @@ setup_module(PyObject *m) {
extern const char *ImagingJpegVersion(void);
PyObject *jpeglib_version = PyUnicode_FromString(ImagingJpegVersion());
PyDict_SetItemString(d, "jpeglib_version", jpeglib_version);
Py_DECREF(jpeglib_version);
Py_XDECREF(jpeglib_version);
}
#endif

Expand All @@ -4222,7 +4222,7 @@ setup_module(PyObject *m) {
extern const char *ImagingJpeg2KVersion(void);
PyObject *jp2klib_version = PyUnicode_FromString(ImagingJpeg2KVersion());
PyDict_SetItemString(d, "jp2klib_version", jp2klib_version);
Py_DECREF(jp2klib_version);
Py_XDECREF(jp2klib_version);
}
#endif

Expand All @@ -4233,7 +4233,7 @@ setup_module(PyObject *m) {
#define tostr(a) tostr1(a)
PyObject *libjpeg_turbo_version = PyUnicode_FromString(tostr(LIBJPEG_TURBO_VERSION));
PyDict_SetItemString(d, "libjpeg_turbo_version", libjpeg_turbo_version);
Py_DECREF(libjpeg_turbo_version);
Py_XDECREF(libjpeg_turbo_version);
#undef tostr
#undef tostr1
#else
Expand All @@ -4249,7 +4249,7 @@ setup_module(PyObject *m) {
extern const char *ImagingImageQuantVersion(void);
PyObject *imagequant_version = PyUnicode_FromString(ImagingImageQuantVersion());
PyDict_SetItemString(d, "imagequant_version", imagequant_version);
Py_DECREF(imagequant_version);
Py_XDECREF(imagequant_version);
}
#else
have_libimagequant = Py_False;
Expand All @@ -4268,7 +4268,7 @@ setup_module(PyObject *m) {
extern const char *ImagingZipVersion(void);
PyObject *zlibversion = PyUnicode_FromString(ImagingZipVersion());
PyDict_SetItemString(d, "zlib_version", zlibversion);
Py_DECREF(zlibversion);
Py_XDECREF(zlibversion);
}
#endif

Expand All @@ -4277,7 +4277,7 @@ setup_module(PyObject *m) {
extern const char *ImagingTiffVersion(void);
PyObject *libtiff_version = PyUnicode_FromString(ImagingTiffVersion());
PyDict_SetItemString(d, "libtiff_version", libtiff_version);
Py_DECREF(libtiff_version);
Py_XDECREF(libtiff_version);

// Test for libtiff 4.0 or later, excluding libtiff 3.9.6 and 3.9.7
PyObject *support_custom_tags;
Expand All @@ -4302,7 +4302,7 @@ setup_module(PyObject *m) {

PyObject *pillow_version = PyUnicode_FromString(version);
PyDict_SetItemString(d, "PILLOW_VERSION", pillow_version);
Py_DECREF(pillow_version);
Py_XDECREF(pillow_version);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/_imagingcms.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ setup_module(PyObject *m) {
v = PyUnicode_FromFormat("%d.%d", vn / 1000, (vn / 10) % 100);
}
PyDict_SetItemString(d, "littlecms_version", v);
Py_DECREF(v);
Py_XDECREF(v);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/_imagingft.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ setup_module(PyObject *m) {

v = PyUnicode_FromFormat("%d.%d.%d", major, minor, patch);
PyDict_SetItemString(d, "freetype2_version", v);
Py_DECREF(v);
Py_XDECREF(v);

#ifdef HAVE_RAQM
#if defined(HAVE_RAQM_SYSTEM) || defined(HAVE_FRIBIDI_SYSTEM)
Expand All @@ -1392,7 +1392,7 @@ setup_module(PyObject *m) {
v = Py_None;
#endif
PyDict_SetItemString(d, "raqm_version", v);
Py_DECREF(v);
Py_XDECREF(v);

#ifdef FRIBIDI_MAJOR_VERSION
{
Expand Down
2 changes: 1 addition & 1 deletion src/_imagingmorph.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ setup_module(PyObject *m) {

PyObject *version = PyUnicode_FromString("0.1");
PyDict_SetItemString(d, "__version", version);
Py_DECREF(version);
Py_XDECREF(version);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/_webp.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ setup_module(PyObject *m) {

PyObject *webpdecoder_version = PyUnicode_FromString(WebPDecoderVersion_str());
PyDict_SetItemString(d, "webpdecoder_version", webpdecoder_version);
Py_DECREF(webpdecoder_version);
Py_XDECREF(webpdecoder_version);

#ifdef HAVE_WEBPANIM
/* Ready object types */
Expand Down