]> git.sur5r.net Git - openocd/commitdiff
jtag: usb_blaster: fix allocation of usb_blaster_device_desc
authorStefan Mahr <stefan.mahr@sphairon.com>
Tue, 12 Mar 2013 10:00:50 +0000 (11:00 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 13 Mar 2013 12:54:46 +0000 (12:54 +0000)
usb_blaster_device_desc was allocated, but never freed.

Change-Id: I764bd092c71b8c260b98aab0e7a1710fd7bfa9fd
Signed-off-by: Stefan Mahr <stefan.mahr@sphairon.com>
Reviewed-on: http://openocd.zylin.com/1224
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
src/jtag/drivers/usb_blaster.c

index 91c4836538c2deaf9a236c6dbeb068d19c72af45..2ef800dbeee97700d2e52646fafdce0e77a498e5 100644 (file)
@@ -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;
 }