clang static analyzer misses that cdb_abort() aborts the process. make it clear we...
authorWilfried Goesgens <dothebart@citadel.org>
Fri, 25 May 2012 10:06:52 +0000 (12:06 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Fri, 25 May 2012 10:06:52 +0000 (12:06 +0200)
citadel/database.c

index 0da1f0f19ab72ee86b75f13e90a78fdd9bdc2719..cdc732cdc8082e90d197d861bdc35889c549942f 100644 (file)
@@ -725,12 +725,15 @@ struct cdbdata *cdb_fetch(int cdb, const void *key, int keylen)
        if (tempcdb == NULL) {
                syslog(LOG_EMERG, "cdb_fetch: Cannot allocate memory for tempcdb\n");
                cdb_abort();
+               return NULL; /* make it easier for static analysis... */
+       }
+       else
+       {
+               tempcdb->len = dret.size;
+               tempcdb->ptr = dret.data;
+               cdb_decompress_if_necessary(tempcdb);
+               return (tempcdb);
        }
-
-       tempcdb->len = dret.size;
-       tempcdb->ptr = dret.data;
-       cdb_decompress_if_necessary(tempcdb);
-       return (tempcdb);
 }
 
 
@@ -770,7 +773,7 @@ void cdb_rewind(int cdb)
 
        if (TSD->cursors[cdb] != NULL) {
                syslog(LOG_EMERG,
-                       "cdb_rewind: must close cursor on database %d before reopening.\n", cdb);
+                      "cdb_rewind: must close cursor on database %d before reopening.\n", cdb);
                cdb_abort();
                /* cclose(TSD->cursors[cdb]); */
        }