Fix `log_config_free` corrupting the config 18/195218/3
authorMichal Bloch <m.bloch@samsung.com>
Tue, 11 Dec 2018 18:03:22 +0000 (19:03 +0100)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Wed, 12 Dec 2018 08:23:32 +0000 (08:23 +0000)
It used to leave the config in a corrupt state that
referenced freed memory and leaked any added entries.
This did not cause any actual problems because no
config structure was ever reused in production code,
only in tests which do that for convenience.

Change-Id: I90a52c31ca2985ab9c67b32849bca426fb3f1ed7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/shared/logconfig.c

index edad451..3839fe5 100644 (file)
@@ -332,7 +332,7 @@ void log_config_free(struct log_config* config)
                free(prev);
        }
 
-       config->begin = NULL;
+       config->begin = config->last = NULL;
 }