Skip to content

Commit 8def42c

Browse files
committed
fixed memory leak on hash
1 parent 1c594c4 commit 8def42c

File tree

6 files changed

+11
-1
lines changed

6 files changed

+11
-1
lines changed

frozendict/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.1
1+
2.3.2

frozendict/src/3_10/frozendictobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,13 +668,15 @@ static Py_hash_t frozendict_hash(PyObject* self) {
668668
}
669669
else {
670670
PyObject* frozen_items = PyFrozenSet_New(frozen_items_tmp);
671+
Py_DECREF(frozen_items_tmp);
671672

672673
if (frozen_items == NULL) {
673674
hash = MINUSONE_HASH;
674675
save_hash = 0;
675676
}
676677
else {
677678
hash = PyFrozenSet_Type.tp_hash(frozen_items);
679+
Py_DECREF(frozen_items);
678680
}
679681
}
680682

frozendict/src/3_6/frozendictobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,13 +680,15 @@ static Py_hash_t frozendict_hash(PyObject* self) {
680680
}
681681
else {
682682
PyObject* frozen_items = PyFrozenSet_New(frozen_items_tmp);
683+
Py_DECREF(frozen_items_tmp);
683684

684685
if (frozen_items == NULL) {
685686
hash = MINUSONE_HASH;
686687
save_hash = 0;
687688
}
688689
else {
689690
hash = PyFrozenSet_Type.tp_hash(frozen_items);
691+
Py_DECREF(frozen_items);
690692
}
691693
}
692694

frozendict/src/3_7/frozendictobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,13 +674,15 @@ static Py_hash_t frozendict_hash(PyObject* self) {
674674
}
675675
else {
676676
PyObject* frozen_items = PyFrozenSet_New(frozen_items_tmp);
677+
Py_DECREF(frozen_items_tmp);
677678

678679
if (frozen_items == NULL) {
679680
hash = MINUSONE_HASH;
680681
save_hash = 0;
681682
}
682683
else {
683684
hash = PyFrozenSet_Type.tp_hash(frozen_items);
685+
Py_DECREF(frozen_items);
684686
}
685687
}
686688

frozendict/src/3_8/frozendictobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,13 +674,15 @@ static Py_hash_t frozendict_hash(PyObject* self) {
674674
}
675675
else {
676676
PyObject* frozen_items = PyFrozenSet_New(frozen_items_tmp);
677+
Py_DECREF(frozen_items_tmp);
677678

678679
if (frozen_items == NULL) {
679680
hash = MINUSONE_HASH;
680681
save_hash = 0;
681682
}
682683
else {
683684
hash = PyFrozenSet_Type.tp_hash(frozen_items);
685+
Py_DECREF(frozen_items);
684686
}
685687
}
686688

frozendict/src/3_9/frozendictobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,13 +674,15 @@ static Py_hash_t frozendict_hash(PyObject* self) {
674674
}
675675
else {
676676
PyObject* frozen_items = PyFrozenSet_New(frozen_items_tmp);
677+
Py_DECREF(frozen_items_tmp);
677678

678679
if (frozen_items == NULL) {
679680
hash = MINUSONE_HASH;
680681
save_hash = 0;
681682
}
682683
else {
683684
hash = PyFrozenSet_Type.tp_hash(frozen_items);
685+
Py_DECREF(frozen_items);
684686
}
685687
}
686688

0 commit comments

Comments
 (0)