Skip to content
Open
Changes from all commits
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
6 changes: 5 additions & 1 deletion src/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
key = PyTuple_GET_ITEM(item, 0);
key_int = (int)PyLong_AsLong(key);
value = PyTuple_GET_ITEM(item, 1);
Py_DECREF(item);

status = 0;
is_core_tag = 0;
Expand All @@ -792,6 +791,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
PyObject *tag_type;
if (PyDict_GetItemRef(types, key, &tag_type) < 0) {
Py_DECREF(encoder);
Py_DECREF(item);
return NULL; // Exception has been already set
}
if (tag_type) {
Expand Down Expand Up @@ -851,6 +851,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
key_int == TIFFTAG_INKNAMES) {
if (!PyBytes_Check(value)) {
Py_DECREF(encoder);
Py_DECREF(item);
PyErr_SetString(PyExc_ValueError, "Incorrect tag value type");
return NULL;
}
Expand All @@ -869,6 +870,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
int stride = 256;
if (len != 768) {
Py_DECREF(encoder);
Py_DECREF(item);
PyErr_SetString(
PyExc_ValueError, "Requiring 768 items for Colormap"
);
Expand Down Expand Up @@ -1029,6 +1031,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
} else if (type == TIFF_ASCII) {
if (!PyBytes_Check(value)) {
Py_DECREF(encoder);
Py_DECREF(item);
PyErr_SetString(PyExc_ValueError, "Incorrect tag value type");
return NULL;
}
Expand All @@ -1053,6 +1056,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
);
}
}
Py_DECREF(item);
if (!status) {
TRACE(("Error setting Field\n"));
Py_DECREF(encoder);
Expand Down
Loading