From 376c4165e373151afc4b20cb0e27e04640a15a05 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Fri, 29 Jan 2021 22:20:31 +0000 Subject: [PATCH] Fix a reference leak in the compiler for compiler_lambda() --- Python/compile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Python/compile.c b/Python/compile.c index 223c63637ff411..1ad443de6dc076 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2688,8 +2688,10 @@ compiler_lambda(struct compiler *c, expr_ty e) qualname = c->u->u_qualname; Py_INCREF(qualname); compiler_exit_scope(c); - if (co == NULL) + if (co == NULL) { + Py_DECREF(qualname); return 0; + } compiler_make_closure(c, co, funcflags, qualname); Py_DECREF(qualname);