libdlog: more careful handling of null function ptrs 42/277042/1
authorMichal Bloch <m.bloch@samsung.com>
Wed, 29 Jun 2022 16:11:36 +0000 (18:11 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Wed, 29 Jun 2022 19:08:40 +0000 (21:08 +0200)
Change-Id: I1e621a3ee594fcabb55ac3b0c19846086780a1ce
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/libdlog/deduplicate.c
src/libdlog/log.c

index d2bb13b..ff9640d 100644 (file)
@@ -167,6 +167,7 @@ void __configure_deduplicate(struct log_config *config)
                return;
 
        if (!value) {
+               deduplicate_func = NULL;
                return;
        } else if (strcmp(value, "only_identical_neighbours") == 0) {
                deduplicate_func = basic_deduplicate;
@@ -184,4 +185,5 @@ void __deduplicate_destroy(void)
        known_hashes_size = 0;
        free(known_hashes_vector);
        known_hashes_vector = NULL;
+       deduplicate_func = NULL;
 }
index 3bc8ed0..6ab4ff8 100644 (file)
@@ -163,6 +163,7 @@ static void __configure_parameters(struct log_config *static_config, struct log_
                                                                        "limiter_apply_to_all_buffers",
                                                                        DEFAULT_CONFIG_LIMITER_APPLY_TO_ALL_BUFFERS);
 
+       stash_failed_log = NULL;
        const char *stash_failed_log_method = log_config_get(both_config, "stash_failed_log_method");
        if (stash_failed_log_method) {
 #ifndef UNIT_TEST
@@ -751,6 +752,7 @@ void __dlog_fini(void)
                destroy_backend = NULL;
        }
        write_to_log = NULL;
+       stash_failed_log = NULL;
        is_initialized = false;
        first = true;