String compare against addresses in range 0 or so due
to not checking if there was an active session first.

Signed-off-by: Øyvind Harboe <[email protected]>
---
 src/jtag/transport.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/jtag/transport.c b/src/jtag/transport.c
index cd6751c..b7a98fd 100644
--- a/src/jtag/transport.c
+++ b/src/jtag/transport.c
@@ -274,18 +274,17 @@ COMMAND_HANDLER(handle_transport_select)
                return ERROR_FAIL;
 
        case 1:                 /* "select FOO" */
-               if(strcmp(session->name, CMD_ARGV[0]) == 0) {
+               if ((session!= NULL) && strcmp(session->name, CMD_ARGV[0]) == 
0) {
                        /* NOP */
                        LOG_DEBUG("transport '%s' is already selected",
                                        CMD_ARGV[0]);
                        return ERROR_OK;
                } else {
-
-               /* we can't change this session's transport after-the-fact */
-               if (session) {
-                       LOG_ERROR("session's transport is already selected.");
-                       return ERROR_FAIL;
-               }
+                       /* we can't change this session's transport 
after-the-fact */
+                       if (session) {
+                               LOG_ERROR("session's transport is already 
selected.");
+                               return ERROR_FAIL;
+                       }
                }
                break;
 
-- 
1.6.3.3

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to