Skip to content

Commit 6328860

Browse files
committed
Fix refleaks on module and in ZstdDict
1 parent 65542c4 commit 6328860

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Modules/_zstd/_zstdmodule.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ add_vars_to_module(PyObject *module)
642642
Py_XDECREF(obj);
643643
return -1;
644644
}
645+
Py_DECREF(obj);
645646

646647
/* Add zstd parameters */
647648
if (add_parameters(module) < 0) {
@@ -664,6 +665,7 @@ add_vars_to_module(PyObject *module)
664665
Py_XDECREF(obj);
665666
return -1;
666667
}
668+
Py_DECREF(obj);
667669

668670
/* _ZSTD_CStreamSizes */
669671
obj = Py_BuildValue("II",
@@ -673,6 +675,7 @@ add_vars_to_module(PyObject *module)
673675
Py_XDECREF(obj);
674676
return -1;
675677
}
678+
Py_DECREF(obj);
676679

677680
/* _ZSTD_DStreamSizes */
678681
obj = Py_BuildValue("II",
@@ -682,6 +685,7 @@ add_vars_to_module(PyObject *module)
682685
Py_XDECREF(obj);
683686
return -1;
684687
}
688+
Py_DECREF(obj);
685689

686690
/* _ZSTD_CONFIG */
687691
obj = Py_BuildValue("isOOO", 8*(int)sizeof(Py_ssize_t), "c",
@@ -698,6 +702,7 @@ add_vars_to_module(PyObject *module)
698702
Py_XDECREF(obj);
699703
return -1;
700704
}
705+
Py_DECREF(obj);
701706

702707
return 0;
703708
}
@@ -721,7 +726,6 @@ add_type_to_module(PyObject *module, const char *name,
721726
return -1;
722727
}
723728

724-
Py_INCREF(temp);
725729
*dest = (PyTypeObject*) temp;
726730

727731
return 0;
@@ -780,7 +784,6 @@ static int _zstd_exec(PyObject *module) {
780784
return -1;
781785
}
782786

783-
Py_INCREF(mod_state->ZstdError);
784787
if (PyModule_AddObjectRef(module, "ZstdError", mod_state->ZstdError) < 0) {
785788
Py_DECREF(mod_state->ZstdError);
786789
return -1;

Modules/_zstd/zdict.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ ZstdDict_dealloc(PyObject *ob)
6161

6262
/* Release dict_content after Free ZSTD_CDict/ZSTD_DDict instances */
6363
Py_CLEAR(self->dict_content);
64+
Py_CLEAR(self->c_dicts);
6465

6566
PyTypeObject *tp = Py_TYPE(self);
6667
PyObject_GC_Del(ob);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy