From 8e3076a4bec3782a7635adbe1ee6cda926524bda Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 16 Jun 2010 00:54:34 +0000 Subject: [PATCH] fix segfault while connecting to a new cable after probing a flash http://blackfin.uclinux.org/gf/tracker/6028 git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1790 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 8 ++++++++ urjtag/src/apps/jtag/jtag.c | 7 +------ urjtag/src/tap/cable.c | 5 +---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 88668c20..92355bc5 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -2,6 +2,14 @@ * src/bus/s3c4510x.c: Punt dead/useless cvs log info. + * src/tap/cable.c (urj_tap_cable_create): Call urj_bus_buses_delete() rather + than manipulate urj_bus directly so the urj_buses structure doesn't get + corrupted. Otherwise we segfault when changing cables after initializing a + bus: cable probe; detect; initbus ...; detectflash ...; cable probe; detect + * src/apps/jtag/jtag.c (cleanup): Call urj_bus_buses_free() to clean up all + buses and not just the active one. + http://blackfin.uclinux.org/gf/tracker/6028 + 2010-06-14 Mike Frysinger * configure.ac: Drop stropts.h check since parport code no longer uses it. diff --git a/urjtag/src/apps/jtag/jtag.c b/urjtag/src/apps/jtag/jtag.c index 3a00016f..d8823d6f 100644 --- a/urjtag/src/apps/jtag/jtag.c +++ b/urjtag/src/apps/jtag/jtag.c @@ -339,12 +339,7 @@ static void cleanup (urj_chain_t *chain) { urj_flash_cleanup (); - - if (urj_bus) - { - URJ_BUS_FREE (urj_bus); - urj_bus = NULL; - } + urj_bus_buses_free (); urj_tap_chain_free (chain); chain = NULL; } diff --git a/urjtag/src/tap/cable.c b/urjtag/src/tap/cable.c index de4d1e78..2d9854dc 100644 --- a/urjtag/src/tap/cable.c +++ b/urjtag/src/tap/cable.c @@ -539,10 +539,7 @@ urj_tap_cable_create (urj_chain_t *chain, const urj_cable_driver_t *driver) urj_cable_t *cable; if (urj_bus) - { - URJ_BUS_FREE (urj_bus); - urj_bus = NULL; - } + urj_bus_buses_delete (urj_bus); urj_tap_chain_disconnect (chain);