Skip to content

Commit

Permalink
Decrement reference count
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Dec 14, 2024
1 parent 946a4de commit 1c61629
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/_avif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,18 +1006,15 @@ static PyMethodDef avifMethods[] = {

static int
setup_module(PyObject *m) {
PyObject *d = PyModule_GetDict(m);

PyObject *v = PyUnicode_FromString(avifVersion());
if (PyDict_SetItemString(d, "libavif_version", v) < 0) {
Py_DECREF(v);
return -1;
}
Py_DECREF(v);

if (PyType_Ready(&AvifDecoder_Type) < 0 || PyType_Ready(&AvifEncoder_Type) < 0) {
return -1;
}

PyObject *d = PyModule_GetDict(m);
PyObject *v = PyUnicode_FromString(avifVersion());
PyDict_SetItemString(d, "libavif_version", v ? v : Py_None);
Py_XDECREF(v);

return 0;
}

Expand All @@ -1034,6 +1031,7 @@ PyInit__avif(void) {

m = PyModule_Create(&module_def);
if (setup_module(m) < 0) {
Py_DECREF(m);
return NULL;
}

Expand Down

0 comments on commit 1c61629

Please sign in to comment.