Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Correction of a crash in sim_memory_uninstall
@ 1999-04-03 11:37 Stephane Carrez
  1999-04-03 12:27 ` Stephane Carrez
  0 siblings, 1 reply; 4+ messages in thread
From: Stephane Carrez @ 1999-04-03 11:37 UTC (permalink / raw)
  To: gdb-patches

Hi!

I've found a problem in the common part of the simulator.
It crashes in `sim_memory_uninstall' when the simulator terminates.

The problem is when this operation walks a list and frees the
sim_memopt objects. It frees the entry (line 457, call to zfree)
and then gets the pointer to the next one, accessing the freed data
(line 461, *entry = (*entry)->next). 

One fix consist in updating 'entry' before the while loop.

Hope this helps,

	Stephane


*** /src/gnu/gdb-19990330/sim/common/sim-memopt.c       Thu Jan 28 15:13:33
1999
--- sim-memopt.c        Sat Apr  3 20:06:42 1999
***************
*** 449,454 ****
--- 449,457 ----
  
        /* delete it and its aliases */
        alias = *entry;
+ 
+       /* next victim */
+       *entry = (*entry)->next;
        while (alias != NULL)
        {
          sim_memopt *dead = alias;
***************
*** 456,464 ****
          sim_core_detach (sd, NULL, dead->level, dead->space, dead->addr);
          zfree (dead);
        }
- 
-       /* next victim */
-       *entry = (*entry)->next;
      }
  }
  
--- 459,464 ----


^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <37066006.ACFDED96.cygnus.patches.gdb@worldnet.fr>]

end of thread, other threads:[~1999-04-14 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-03 11:37 Correction of a crash in sim_memory_uninstall Stephane Carrez
1999-04-03 12:27 ` Stephane Carrez
     [not found] <37066006.ACFDED96.cygnus.patches.gdb@worldnet.fr>
1999-04-14 12:46 ` Frank Ch. Eigler
1999-04-14 13:22   ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox