Skip to content

Commit 83ccea7

Browse files
committed
decref newconst on error
1 parent fa005f3 commit 83ccea7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Python/flowgraph.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,8 +1418,12 @@ instr_make_load_const(cfg_instr *instr, PyObject *newconst,
14181418
PyObject *consts, PyObject *const_cache)
14191419
{
14201420
int res = maybe_instr_make_load_smallint(instr, newconst, consts, const_cache);
1421-
if (res) {
1422-
return res == -1 ? ERROR : SUCCESS;
1421+
if (res < 0) {
1422+
Py_DECREF(newconst);
1423+
return ERROR;
1424+
}
1425+
if (res > 0) {
1426+
return SUCCESS;
14231427
}
14241428
int oparg = add_const(newconst, consts, const_cache);
14251429
RETURN_IF_ERROR(oparg);

0 commit comments

Comments
 (0)