From 249bd05038df27cb39fcc5fe25d9f47eb33f68a0 Mon Sep 17 00:00:00 2001 From: Ting-Yuan Huang Date: Tue, 15 Aug 2017 17:01:33 -0700 Subject: [PATCH] Suppress false-positive static analyzer warnings by hinting the analyzer with assertions. Test: built without seeing warnings. Change-Id: I0d43d4ceafd7f68be89cad6c930c85ee7b6d5165 --- liblog/local_logger.c | 1 + liblog/logprint.c | 1 + 2 files changed, 2 insertions(+) diff --git a/liblog/local_logger.c b/liblog/local_logger.c index 522867d4f..563cb3f9b 100644 --- a/liblog/local_logger.c +++ b/liblog/local_logger.c @@ -222,6 +222,7 @@ static int LogBufferLog(struct LogBuffer* log, log->last[logId] = node->prev; } list_remove(node); + LOG_ALWAYS_FATAL_IF(node == log->last[logId], "corrupted list"); free(e); } /* add entry to list */ diff --git a/liblog/logprint.c b/liblog/logprint.c index b62f8b446..a2839bfb6 100644 --- a/liblog/logprint.c +++ b/liblog/logprint.c @@ -250,6 +250,7 @@ LIBLOG_ABI_PUBLIC void android_log_format_free(AndroidLogFormat* p_format) { while (!list_empty(&convertHead)) { struct listnode* node = list_head(&convertHead); list_remove(node); + LOG_ALWAYS_FATAL_IF(node == list_head(&convertHead), "corrupted list"); free(node); } }