diff --git a/TODO.txt b/TODO.txt index 5aa9ba3..9ce67b1 100644 --- a/TODO.txt +++ b/TODO.txt @@ -82,7 +82,7 @@ Milestone: v0.3.0 [ ] Refactor dev pages so function description and return value are in the same location. -[ ] Debug memory leaks with caching +[x] Debug memory leaks with caching [ ] Debug OpenSSL [~] Client-Server API diff --git a/src/Db.c b/src/Db.c index 0def0d5..bfb1009 100644 --- a/src/Db.c +++ b/src/Db.c @@ -805,7 +805,7 @@ DbUnlock(Db * db, DbRef * ref) { pthread_mutex_unlock(&db->lock); Log(LOG_ERR, "Failed to truncate file on disk."); - Log(LOG_ERR, "Error: %s", strerror(errno)); + Log(LOG_ERR, "Error on fd %d: %s", ref->fd, strerror(errno)); return 0; } diff --git a/src/Routes/RouteUiaFallback.c b/src/Routes/RouteUiaFallback.c index 878db54..e755d26 100644 --- a/src/Routes/RouteUiaFallback.c +++ b/src/Routes/RouteUiaFallback.c @@ -39,6 +39,7 @@ ROUTE_IMPL(RouteUiaFallback, path, argp) if (!authType) { /* This should never happen */ + Log(LOG_ERR, "Programmer error in RouteUiaFallback()!"); HttpResponseStatus(args->context, HTTP_INTERNAL_SERVER_ERROR); return MatrixErrorCreate(M_UNKNOWN); } @@ -55,6 +56,7 @@ ROUTE_IMPL(RouteUiaFallback, path, argp) config = ConfigLock(args->matrixArgs->db); if (!config) { + Log(LOG_ERR, "UIA fallback failed to lock configuration."); HttpResponseStatus(args->context, HTTP_INTERNAL_SERVER_ERROR); return MatrixErrorCreate(M_UNKNOWN); } diff --git a/src/Tls/TlsOpenSSL.c b/src/Tls/TlsOpenSSL.c index 61de4b0..c2e950e 100644 --- a/src/Tls/TlsOpenSSL.c +++ b/src/Tls/TlsOpenSSL.c @@ -226,7 +226,6 @@ TlsRead(void *cookie, void *buf, size_t nBytes) if (ret <= 0) { - ret = -1; switch (SSL_get_error(ssl->ssl, ret)) { case SSL_ERROR_WANT_READ: @@ -243,6 +242,7 @@ TlsRead(void *cookie, void *buf, size_t nBytes) errno = EIO; break; } + ret = -1; } return ret; @@ -256,7 +256,6 @@ TlsWrite(void *cookie, void *buf, size_t nBytes) if (ret <= 0) { - ret = -1; switch (SSL_get_error(ssl->ssl, ret)) { case SSL_ERROR_WANT_READ: @@ -273,6 +272,7 @@ TlsWrite(void *cookie, void *buf, size_t nBytes) errno = EIO; break; } + ret = -1; } return ret;