chiark / gitweb /
journald: be nice to coverity, add an extra assert
authorLennart Poettering <lennart@poettering.net>
Mon, 27 Oct 2014 22:50:51 +0000 (23:50 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 27 Oct 2014 22:50:53 +0000 (23:50 +0100)
coverity otherwise assumes that the chain object might be NULL.

src/journal/journal-file.c

index d06dbc2f753397efd6408a0d451fd6ab914cc948..8a2c0fcac52d7efd3ec666e9b89aa2ae2fec81c4 100644 (file)
@@ -1380,9 +1380,10 @@ static void chain_cache_put(
                 if (array == first)
                         return;
 
-                if (ordered_hashmap_size(h) >= CHAIN_CACHE_MAX)
+                if (ordered_hashmap_size(h) >= CHAIN_CACHE_MAX) {
                         ci = ordered_hashmap_steal_first(h);
-                else {
+                        assert(ci);
+                } else {
                         ci = new(ChainCacheItem, 1);
                         if (!ci)
                                 return;