cache size isn't known yet.
(free_register_cache): Avoid dereferencing a NULL regcache.
+2008-09-08 Pedro Alves <pedro@codesourcery.com>
+
+ * regcache.c (new_register_cache): Return NULL if the register
+ cache size isn't known yet.
+ (free_register_cache): Avoid dereferencing a NULL regcache.
+
2008-09-04 Daniel Jacobowitz <dan@codesourcery.com>
* configure.srv: Merge MIPS and MIPS64.
{
struct inferior_regcache_data *regcache;
+ if (register_bytes == 0)
+ return NULL; /* The architecture hasn't been initialized yet. */
+
regcache = malloc (sizeof (*regcache));
/* Make sure to zero-initialize the register cache when it is created,
struct inferior_regcache_data *regcache
= (struct inferior_regcache_data *) regcache_p;
- free (regcache->registers);
- free (regcache);
+ if (regcache)
+ {
+ free (regcache->registers);
+ free (regcache);
+ }
}
static void