afs: Add assertion to afs_cb_result_handler().
authorAndre Noll <maan@systemlinux.org>
Tue, 1 Jan 2013 23:20:04 +0000 (23:20 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 10 Feb 2013 14:27:53 +0000 (15:27 +0100)
If cc is NULL we always have a bug, so it's OK to dereference this
pointer unconditionally. However, if the command handler crashes
due to cc being NULL, it is not obvious what has happened, so make
this explicit.

afs.c

diff --git a/afs.c b/afs.c
index 1f3fafacec1c757b47659c77d2bf2da1062e3cbf..906616d7865d8926841dfc1c587984e01e2f80dc 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -604,6 +604,7 @@ int afs_cb_result_handler(struct osl_object *result, uint8_t band,
 {
        struct command_context *cc = private;
 
+       assert(cc);
        if (!result->size)
                return 1;
        if (cc->use_sideband)