From 3ce9f3fc5eb5103ea9805d9d3476a1a3a52bf481 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Fri, 25 May 2012 12:06:52 +0200 Subject: [PATCH] clang static analyzer misses that cdb_abort() aborts the process. make it clear we don't march on here. --- citadel/database.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/citadel/database.c b/citadel/database.c index 0da1f0f19..cdc732cdc 100644 --- a/citadel/database.c +++ b/citadel/database.c @@ -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]); */ } -- 2.30.2