diff options
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/assuan.c | 4 | ||||
-rw-r--r-- | src/debug.c | 12 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9e0d9b4..33df124 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-01-14 Werner Koch <wk@g10code.com> + + * debug.c (_assuan_debug, _assuan_debug_begin) + (_assuan_debug_buffer): Check CTX before dereferencing. + + * assuan.c (assuan_release): Immediately leave on NULL CTX. + 2010-01-05 Marcus Brinkmann <marcus@g10code.de> * debug.h (TRACE_LOG5): Add macro. diff --git a/src/assuan.c b/src/assuan.c index 31263d4..21dd29d 100644 --- a/src/assuan.c +++ b/src/assuan.c @@ -176,11 +176,11 @@ _assuan_reset (assuan_context_t ctx) void assuan_release (assuan_context_t ctx) { - TRACE (ctx, ASSUAN_LOG_CTX, "assuan_release", ctx); - if (! ctx) return; + TRACE (ctx, ASSUAN_LOG_CTX, "assuan_release", ctx); + _assuan_reset (ctx); /* None of the members that are our responsibility requires deallocation. */ diff --git a/src/debug.c b/src/debug.c index 0bdbfb5..1b654b7 100644 --- a/src/debug.c +++ b/src/debug.c @@ -49,7 +49,7 @@ _assuan_debug (assuan_context_t ctx, unsigned int cat, const char *format, ...) char *msg; int res; - if (ctx->log_cb == NULL) + if (!ctx || !ctx->log_cb) return; saved_errno = errno; @@ -75,8 +75,9 @@ _assuan_debug_begin (assuan_context_t ctx, *line = NULL; /* Probe if this wants to be logged based on category. */ - if (! ctx->log_cb || - ! (*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL)) + if (! ctx + || ! ctx->log_cb + || ! (*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL)) return; va_start (arg_ptr, format); @@ -144,8 +145,9 @@ _assuan_debug_buffer (assuan_context_t ctx, unsigned int cat, int j; /* Probe if this wants to be logged based on category. */ - if (! ctx->log_cb || - ! (*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL)) + if (!ctx + || ! ctx->log_cb + || ! (*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL)) return; while (idx < len) |