Skip to content

Commit 47da5db

Browse files
committed
Properly decref magic bytes representation
1 parent b78ef86 commit 47da5db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/isal/isal_zlibmodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1684,9 +1684,11 @@ GzipReader_read_into_buffer(GzipReader *self, uint8_t *out_buffer, size_t out_bu
16841684

16851685
if (!(magic1 == 0x1f && magic2 == 0x8b)) {
16861686
Py_BLOCK_THREADS;
1687+
PyObject *magic_obj = PyBytes_FromStringAndSize((char *)current_pos, 2);
16871688
PyErr_Format(BadGzipFile,
16881689
"Not a gzipped file (%R)",
1689-
PyBytes_FromStringAndSize((char *)current_pos, 2));
1690+
magic_obj);
1691+
Py_DECREF(magic_obj);
16901692
return -1;
16911693
};
16921694
uint8_t method = current_pos[2];

0 commit comments

Comments
 (0)