diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index dd2b919..58d070f 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -626,6 +626,7 @@ plpython_inline_handler(PG_FUNCTION_ARGS)
 	PG_CATCH();
 	{
 		PLy_procedure_delete(proc);
+		PLy_free(proc);
 		PLy_curr_procedure = save_curr_proc;
 		PyErr_Clear();
 		PG_RE_THROW();
@@ -633,6 +634,7 @@ plpython_inline_handler(PG_FUNCTION_ARGS)
 	PG_END_TRY();
 
 	PLy_procedure_delete(proc);
+	PLy_free(proc);
 
 	/* Pop the error context stack */
 	error_context_stack = plerrcontext.previous;
