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

src/ftxfont.c

index 53f2616..5bba449 100644 (file)
@@ -78,7 +78,7 @@ ftxfont_get_gcs (struct frame *f, unsigned long foreground, unsigned long backgr
        }
     }
 
-  new = malloc (sizeof *new);
+  new = xmalloc_unsafe (sizeof *new);
   if (! new)
     return NULL;
   new->next = this;
@@ -88,7 +88,7 @@ ftxfont_get_gcs (struct frame *f, unsigned long foreground, unsigned long backgr
     }
   else if (font_put_frame_data (f, &ftxfont_driver, new) < 0)
     {
-      free (new);
+      xfree (new);
       return NULL;
     }
 
@@ -124,7 +124,7 @@ ftxfont_get_gcs (struct frame *f, unsigned long foreground, unsigned long backgr
        prev->next = new->next;
       else if (data)
        font_put_frame_data (f, &ftxfont_driver, new->next);
-      free (new);
+      xfree (new);
       return NULL;
     }
   return new->gcs;