]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix unlikely core dump with Xaw
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 23 Aug 2022 23:25:40 +0000 (16:25 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 26 Aug 2022 01:30:10 +0000 (18:30 -0700)
* lwlib/lwlib-Xaw.c (make_dialog): Don’t dump core if calloc fails.
Caught with --enable-gcc-warnings.

lwlib/lwlib-Xaw.c

index d17acae728b4eae3e7f784f58a25e621bed90a4d..b09795ec38ca01dff90421b8c48a0da10e4f15d2 100644 (file)
@@ -594,6 +594,8 @@ make_dialog (char* name,
             int nr_xft_data = left_buttons + right_buttons + 1;
             instance->xft_data = calloc (nr_xft_data + 1,
                                          sizeof(*instance->xft_data));
+           if (!instance->xft_data)
+             memory_full ((nr_xft_data + 1) * sizeof *instance->xft_data);
 
             fill_xft_data (&instance->xft_data[0], w, xft_font);
            XtAddCallback (dialog, XtNdestroyCallback, destroy_xft_data,