From: Mathias K Date: Tue, 29 Nov 2011 08:37:44 +0000 (+0100) Subject: target init sanity check X-Git-Tag: v0.6.0-rc1~387 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ea54ea5364b855ffc6d2733463308a63f9a8e307;p=openocd target init sanity check Add a test if the pointer to the target_init function in the target struct is set before the function pointer is used. Change-Id: Ie4ea542f64f35efce8c5bce2ced9b881bf283ec1 Signed-off-by: Mathias K Reviewed-on: http://openocd.zylin.com/241 Tested-by: jenkins Reviewed-by: Øyvind Harboe --- diff --git a/src/target/target.c b/src/target/target.c index bcd00a1f..a414a6a7 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -940,6 +940,8 @@ static int target_init_one(struct command_context *cmd_ctx, if (type->check_reset== NULL) type->check_reset = default_check_reset; + assert(type->init_target != NULL); + int retval = type->init_target(cmd_ctx, target); if (ERROR_OK != retval) {