From f1d5a71bbcfccb638750bb68b92bd0f7399bdfc0 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 12 Apr 2024 15:54:23 +0100 Subject: [PATCH] girparser: Silence a scan-build NULL pointer dereference warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s very obviously a false positive, as `str` has been added to on the previous line, so can’t be `(void *) 0`. Not sure what scan-build is thinking. I’d rather not have this assertion (it doesn’t help the programmer’s understanding of the code), but I would also rather have scan-build running with no warnings so that it can helpfully catch newly-introduced errors in future. Signed-off-by: Philip Withnall Helps: #1767 --- girepository/girparser.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/girepository/girparser.c b/girepository/girparser.c index c80574f3f..dee322b50 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -670,6 +670,9 @@ parse_type_internal (GIIrModule *module, type->is_pointer = TRUE; str += strlen ("Error"); + /* Silence a scan-build false positive */ + g_assert (str != NULL); + if (*str == '<') { char *tmp, *end;