diff --git a/TODO b/TODO
index 3a9e787a1d71314ac99ca8aea596a9d058263f52..2a04644f21ecc204b6f35d30ceef4b7876d81513 100644
--- a/TODO
+++ b/TODO
@@ -2,10 +2,8 @@ Next (in order of descending priority/precedence):
 
 * Finish the test suite for the base functionality
 * Final issues:
-	- FIXME hunting
 	- Fix/Report issues listed in 'doc/rfc/RFC Controversy.txt'
 
-
 * ## MAKE A FIRST RELEASE (0.1.x) ##
 
 * Fix remaining RFC deviations:
diff --git a/src/lib-sieve/plugins/variables/ext-variables-dump.c b/src/lib-sieve/plugins/variables/ext-variables-dump.c
index b4845dab666ec2c63d4aaa79da3b9d8676641b09..aa8d9256d97f114ac86b1c67202747427489405b 100644
--- a/src/lib-sieve/plugins/variables/ext-variables-dump.c
+++ b/src/lib-sieve/plugins/variables/ext-variables-dump.c
@@ -12,6 +12,18 @@
 #include "ext-variables-common.h"
 #include "ext-variables-dump.h"
 
+/*
+ * Code dumper extension
+ */
+
+static void ext_variables_code_dumper_free
+	(struct sieve_code_dumper *dumper, void *context);
+
+const struct sieve_code_dumper_extension variables_dump_extension = {
+	&variables_extension,
+	ext_variables_code_dumper_free
+};
+
 /*
  * Code dump context
  */
@@ -21,6 +33,18 @@ struct ext_variables_dump_context {
 	ARRAY_DEFINE(ext_scopes, struct sieve_variable_scope *);
 };
 
+static void ext_variables_code_dumper_free
+(struct sieve_code_dumper *dumper ATTR_UNUSED, void *context)
+{
+	struct ext_variables_dump_context *dctx = 
+		(struct ext_variables_dump_context *) context;
+
+	if ( dctx == NULL || dctx->main_scope == NULL )
+		return;
+
+	sieve_variable_scope_unref(&dctx->main_scope);
+}
+
 static struct ext_variables_dump_context *ext_variables_dump_get_context
 	(const struct sieve_dumptime_env *denv)
 {
@@ -44,7 +68,6 @@ static struct ext_variables_dump_context *ext_variables_dump_get_context
 bool ext_variables_code_dump
 (const struct sieve_dumptime_env *denv, sieve_size_t *address)
 {
-	struct sieve_code_dumper *dumper = denv->cdumper;
 	struct ext_variables_dump_context *dctx;
 	struct sieve_variable_scope *main_scope;
 	unsigned int i, scope_size;
@@ -59,7 +82,6 @@ bool ext_variables_code_dump
 	if ( !sieve_binary_read_offset(denv->sbin, address, &end_offset) )
 		return FALSE;
 	
-	/* FIXME: MEMLEAK!! Scope is never unreferenced */
 	main_scope = sieve_variable_scope_create(NULL);
 	
 	sieve_code_dumpf(denv, "SCOPE [%u] (end: %08x)",