add whether we're in which eventloop / a worker thread to the log output.
[citadel.git] / citadel / database.c
index 23e7133516c3926697a4bda48a17fe9c0d0c2799..3f5123f0189b7ed2334fff56b92ce7d2cf096e71 100644 (file)
@@ -889,8 +889,8 @@ int SeentDebugEnabled = 0;
 #define DBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (SeentDebugEnabled != 0))
 #define SEENM_syslog(LEVEL, FORMAT)                                    \
        DBGLOG(LEVEL) syslog(LEVEL,                                     \
-                            "IO[%ld]CC[%ld] SEEN[%s][%d] " FORMAT,     \
-                            ioid, ccid, Facility, cType)
+                            "%s[%ld]CC[%ld] SEEN[%s][%d] " FORMAT,     \
+                            IOSTR, ioid, ccid, Facility, cType)
 
 time_t CheckIfAlreadySeen(const char *Facility,
                          StrBuf *guid,
@@ -908,7 +908,7 @@ time_t CheckIfAlreadySeen(const char *Facility,
        {
                SEENM_syslog(LOG_DEBUG, "Loading");
                cdbut = cdb_fetch(CDB_USETABLE, SKEY(guid));
-               if (cdbut != NULL) {
+               if ((cdbut != NULL) && (cdbut->ptr != NULL)) {
                        memcpy(&ut, cdbut->ptr,
                               ((cdbut->len > sizeof(struct UseTable)) ?
                                sizeof(struct UseTable) : cdbut->len));
@@ -929,6 +929,8 @@ time_t CheckIfAlreadySeen(const char *Facility,
                }
                else
                {
+                       if (cdbut) cdb_free(cdbut);
+
                        SEENM_syslog(LOG_DEBUG, "not Found");
                }