From 4f05e4cc4e6f74d0c8273abf588636b93cccd760 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 14 Jan 2010 21:16:55 +0000 Subject: Fix NULL de-reference in debug code. --- src/debug.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/debug.c') 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) -- cgit v1.2.3