]> granicus.if.org Git - esp-idf/commitdiff
log: fix minor memory leak when cleaning list of log levels
authorDavid Cermak <cermak@espressif.com>
Fri, 14 Jun 2019 09:42:11 +0000 (11:42 +0200)
committerDavid Cermak <cermak@espressif.com>
Fri, 14 Jun 2019 11:55:46 +0000 (13:55 +0200)
components/log/log.c

index 72c232c68bf65d115c751758ef6b823d893fb242..c59469cc022e48ec562fb478eeefa72dc6247c60 100644 (file)
@@ -174,8 +174,10 @@ void esp_log_level_set(const char* tag, esp_log_level_t level)
 
 void clear_log_level_list()
 {
-    while( !SLIST_EMPTY(&s_log_tags)) {
+    uncached_tag_entry_t *it;
+    while((it = SLIST_FIRST(&s_log_tags)) != NULL) {
         SLIST_REMOVE_HEAD(&s_log_tags, entries );
+        free(it);
     }
     s_log_cache_entry_count = 0;
     s_log_cache_max_generation = 0;