This is an automated email from Gerrit.

Paul Fertser (fercer...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/2550

-- gerrit

commit d4c74fb27a5df9f706f57399606aef8fd8d7f589
Author: Paul Fertser <fercer...@gmail.com>
Date:   Sun Feb 15 21:37:16 2015 +0300

    stlink: avoid null pointer dereference in stlink_usb_close()
    
    Otherwise it happens if stlink can not be open on start.
    
    Change-Id: I7088f10e61508dae230eccfe576a51498c92f5b8
    Signed-off-by: Paul Fertser <fercer...@gmail.com>

diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index 1b59653..9818dda 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -1572,14 +1572,14 @@ static int stlink_speed(void *handle, int khz, bool 
query)
 }
 
 /** */
-static int stlink_usb_close(void *fd)
+static int stlink_usb_close(void *handle)
 {
-       struct stlink_usb_handle_s *h = fd;
+       struct stlink_usb_handle_s *h = handle;
 
-       if (h->fd)
+       if (h && h->fd)
                jtag_libusb_close(h->fd);
 
-       free(fd);
+       free(h);
 
        return ERROR_OK;
 }

-- 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to