From: Paul Fertser Date: Sun, 1 Feb 2015 19:19:38 +0000 (+0300) Subject: target/image: fix undefined behaviour when loading with GDB X-Git-Tag: v0.9.0-rc1~145 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c8d351b1bf592046cef7dc48d84eb10a1ba93993;p=openocd target/image: fix undefined behaviour when loading with GDB The image struct is malloc'd and hence base_address_set doesn't have a defined value. Caught by Valgrind. Change-Id: Ice15b2299fc768e44e8034eeb93e035076eacd03 Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2524 Tested-by: jenkins Reviewed-by: Stian Skjelstad Reviewed-by: Spencer Oliver --- diff --git a/src/target/image.c b/src/target/image.c index 07420b1f..b1b7e3a6 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -788,6 +788,7 @@ int image_open(struct image *image, const char *url, const char *type_string) } } else if (image->type == IMAGE_BUILDER) { image->num_sections = 0; + image->base_address_set = 0; image->sections = NULL; image->type_private = NULL; }