Skip to content

Commit 62cba6f

Browse files
committed
smash diff
1 parent c155d19 commit 62cba6f

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

Modules/zlibmodule.c

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -282,24 +282,21 @@ newcompobject(PyTypeObject *type)
282282
self->zdict = NULL;
283283
self->unused_data = Py_GetConstant(Py_CONSTANT_EMPTY_BYTES);
284284
if (self->unused_data == NULL) {
285-
goto error;
285+
Py_DECREF(self);
286+
return NULL;
286287
}
287288
self->unconsumed_tail = Py_GetConstant(Py_CONSTANT_EMPTY_BYTES);
288289
if (self->unconsumed_tail == NULL) {
289-
goto error;
290+
Py_DECREF(self);
291+
return NULL;
290292
}
291293
self->lock = PyThread_allocate_lock();
292294
if (self->lock == NULL) {
295+
Py_DECREF(self);
293296
PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock");
294-
goto error;
297+
return NULL;
295298
}
296-
297-
PyObject_GC_Track(self);
298299
return self;
299-
300-
error:
301-
Py_DECREF(self);
302-
return NULL;
303300
}
304301

305302
static void*
@@ -1776,41 +1773,40 @@ zlib__ZlibDecompressor_impl(PyTypeObject *type, int wbits, PyObject *zdict)
17761773
self->zst.avail_in = 0;
17771774
self->unused_data = PyBytes_FromStringAndSize(NULL, 0);
17781775
if (self->unused_data == NULL) {
1779-
goto error;
1776+
Py_CLEAR(self);
1777+
return NULL;
17801778
}
17811779
self->lock = PyThread_allocate_lock();
17821780
if (self->lock == NULL) {
1781+
Py_DECREF(self);
17831782
PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock");
1784-
goto error;
1783+
return NULL;
17851784
}
17861785
int err = inflateInit2(&(self->zst), wbits);
17871786
switch (err) {
17881787
case Z_OK:
17891788
self->is_initialised = 1;
17901789
if (self->zdict != NULL && wbits < 0) {
17911790
if (set_inflate_zdict_ZlibDecompressor(state, self) < 0) {
1792-
goto error;
1791+
Py_DECREF(self);
1792+
return NULL;
17931793
}
17941794
}
1795-
break;
1795+
return (PyObject *)self;
17961796
case Z_STREAM_ERROR:
1797+
Py_DECREF(self);
17971798
PyErr_SetString(PyExc_ValueError, "Invalid initialization option");
1798-
goto error;
1799+
return NULL;
17991800
case Z_MEM_ERROR:
1801+
Py_DECREF(self);
18001802
PyErr_SetString(PyExc_MemoryError,
18011803
"Can't allocate memory for decompression object");
1802-
goto error;
1804+
return NULL;
18031805
default:
18041806
zlib_error(state, self->zst, err, "while creating decompression object");
1805-
goto error;
1807+
Py_DECREF(self);
1808+
return NULL;
18061809
}
1807-
1808-
PyObject_GC_Track(self);
1809-
return (PyObject *)self;
1810-
1811-
error:
1812-
Py_DECREF(self);
1813-
return NULL;
18141810
}
18151811

18161812
#include "clinic/zlibmodule.c.h"

0 commit comments

Comments
 (0)