From: Stefan Mahr Date: Tue, 12 Mar 2013 10:00:50 +0000 (+0100) Subject: jtag: usb_blaster: fix allocation of usb_blaster_device_desc X-Git-Tag: v0.7.0-rc1~46 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=30fde70c0321fd70d9330d5c6b56ed4e86653dd9;p=openocd jtag: usb_blaster: fix allocation of usb_blaster_device_desc usb_blaster_device_desc was allocated, but never freed. Change-Id: I764bd092c71b8c260b98aab0e7a1710fd7bfa9fd Signed-off-by: Stefan Mahr Reviewed-on: http://openocd.zylin.com/1224 Reviewed-by: Spencer Oliver Tested-by: jenkins --- diff --git a/src/jtag/drivers/usb_blaster.c b/src/jtag/drivers/usb_blaster.c index 91c48365..2ef800db 100644 --- a/src/jtag/drivers/usb_blaster.c +++ b/src/jtag/drivers/usb_blaster.c @@ -338,7 +338,7 @@ static int usb_blaster_init(void) if (usb_blaster_device_desc == NULL) { LOG_WARNING("no usb_blaster device description specified, " "using default 'USB-Blaster'"); - usb_blaster_device_desc = "USB-Blaster"; + usb_blaster_device_desc = strdup("USB-Blaster"); } #if IS_WIN32 == 0 @@ -469,6 +469,11 @@ static int usb_blaster_quit(void) ftdi_deinit(&ftdic); #endif + if (usb_blaster_device_desc) { + free(usb_blaster_device_desc); + usb_blaster_device_desc = NULL; + } + return ERROR_OK; }