summaryrefslogtreecommitdiffstats
path: root/library/python/runtime_py3/sitecustomize.cpp
diff options
context:
space:
mode:
authoratarasov5 <[email protected]>2026-04-25 09:49:26 +0300
committeratarasov5 <[email protected]>2026-04-25 10:22:10 +0300
commite1a7571be0fe6bcf30b7aad897281b174448b30e (patch)
tree432b54f046cc867cbf641fc4ee2210a8c5b52b1a /library/python/runtime_py3/sitecustomize.cpp
parentcbd77b02b3fff2de323862c8e822d7d53f6163a9 (diff)
YQL-20347: Fix memory leak
Описание проблемы в тикете commit_hash:9738f25866ad42e1e6f24191fdbc64feac814c2b
Diffstat (limited to 'library/python/runtime_py3/sitecustomize.cpp')
-rw-r--r--library/python/runtime_py3/sitecustomize.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/library/python/runtime_py3/sitecustomize.cpp b/library/python/runtime_py3/sitecustomize.cpp
index be68ad39780..3029ba155c5 100644
--- a/library/python/runtime_py3/sitecustomize.cpp
+++ b/library/python/runtime_py3/sitecustomize.cpp
@@ -1,6 +1,8 @@
#include <Python.h>
#include <marshal.h>
+#include <util/generic/scope.h>
+
#include <iterator>
namespace {
@@ -17,6 +19,9 @@ int modsitecustomize_exec(PyObject *mod) noexcept {
if (!bytecode) {
return -1;
}
+ Y_DEFER {
+ Py_DECREF(bytecode);
+ };
PyObject* modns = PyModule_GetDict(mod);
if (!modns) {
return -1;