From 1acd60f83aedda93d74f6f40aa92b6d3b1e05d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 24 Sep 2022 12:50:40 +0700 Subject: [PATCH] profanity: fix a small memory leak in Python 3.11 --- srcpkgs/profanity/patches/python-3.11.patch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/srcpkgs/profanity/patches/python-3.11.patch b/srcpkgs/profanity/patches/python-3.11.patch index 6afe49dc2a7..56e9762ad5d 100644 --- a/srcpkgs/profanity/patches/python-3.11.patch +++ b/srcpkgs/profanity/patches/python-3.11.patch @@ -1,6 +1,8 @@ +diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c +index 0b91cf70..091b3b4a 100644 --- a/src/plugins/python_api.c +++ b/src/plugins/python_api.c -@@ -1619,8 +1619,14 @@ static char* +@@ -1619,8 +1619,16 @@ static char* _python_plugin_name(void) { PyThreadState* ts = PyThreadState_Get(); @@ -8,6 +10,8 @@ + PyFrameObject* frame = PyThreadState_GetFrame(ts); + PyCodeObject* code = PyFrame_GetCode(frame); + char* filename = python_str_or_unicode_to_string(code->co_filename); ++ Py_DECREF(code); ++ Py_DECREF(frame); +#else PyFrameObject* frame = ts->frame; char* filename = python_str_or_unicode_to_string(frame->f_code->co_filename);