use xmalloc_unsafe in current_minor_maps
authorBT Templeton <bpt@hcoop.net>
Thu, 28 Jun 2012 03:17:47 +0000 (23:17 -0400)
committerRobin Templeton <robin@terpri.org>
Sat, 18 Apr 2015 22:49:07 +0000 (18:49 -0400)
* src/keymap.c (current_minor_maps): Use `xmalloc_unsafe'.

src/keymap.c

index 0b2b61d..739af68 100644 (file)
@@ -1477,26 +1477,26 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
                /* Use malloc here.  See the comment above this function.
                   Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */
                block_input ();
-               newmodes = malloc (allocsize);
+               newmodes = xmalloc_unsafe (allocsize);
                if (newmodes)
                  {
                    if (cmm_modes)
                      {
                        memcpy (newmodes, cmm_modes,
                                cmm_size * sizeof cmm_modes[0]);
-                       free (cmm_modes);
+                       xfree (cmm_modes);
                      }
                    cmm_modes = newmodes;
                  }
 
-               newmaps = malloc (allocsize);
+               newmaps = xmalloc_unsafe (allocsize);
                if (newmaps)
                  {
                    if (cmm_maps)
                      {
                        memcpy (newmaps, cmm_maps,
                                cmm_size * sizeof cmm_maps[0]);
-                       free (cmm_maps);
+                       xfree (cmm_maps);
                      }
                    cmm_maps = newmaps;
                  }