Skip to content
Snippets Groups Projects
Commit 76534ffd authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Fixed TODO: made sure main scope used in variables dumping is unreferenced...

Fixed TODO: made sure main scope used in variables dumping is unreferenced when code dumper is freed.
parent 830d93e4
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
......@@ -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)",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.