Remove some X-Face cruft and check after realloc
authorRicardo Mones <ricardo@mones.org>
Wed, 19 Feb 2014 00:36:37 +0000 (01:36 +0100)
committerRicardo Mones <ricardo@mones.org>
Wed, 19 Feb 2014 00:36:37 +0000 (01:36 +0100)
src/headerview.c
src/plugins/pgpcore/sgpgme.c
src/textview.c

index 1ea12ba..2d7074b 100644 (file)
 #include "addrindex.h"
 
 #if HAVE_LIBCOMPFACE
-#define XPM_XFACE_HEIGHT       (HEIGHT + 3)  /* 3 = 1 header + 2 colors */
-
-static gchar *xpm_xface[XPM_XFACE_HEIGHT];
-
 static gint headerview_show_xface      (HeaderView     *headerview,
                                         MsgInfo        *msginfo);
 #endif
@@ -193,17 +189,6 @@ void headerview_init(HeaderView *headerview)
        headerview_set_font(headerview);
        headerview_clear(headerview);
        headerview_set_visibility(headerview, prefs_common.display_header_pane);
-
-#if HAVE_LIBCOMPFACE
-       {
-               gint i;
-
-               for (i = 0; i < XPM_XFACE_HEIGHT; i++) {
-                       xpm_xface[i] = g_malloc(WIDTH + 1);
-                       *xpm_xface[i] = '\0';
-               }
-       }
-#endif
 }
 
 void headerview_show(HeaderView *headerview, MsgInfo *msginfo)
index f06c88c..d30ef72 100644 (file)
@@ -947,6 +947,10 @@ void *sgpgme_data_release_and_get_mem(gpgme_data_t data, size_t *len)
        cm_gpgme_data_rewind(data);
        while ((r = gpgme_data_read(data, buf, BUFSIZ)) > 0) {
                result = realloc(result, r + w);
+               if (result == NULL) {
+                       g_warning("can't allocate memory\n");
+                       return NULL;
+               }
                memcpy(result+w, buf, r);
                w += r;
        }
index cac63bf..5575bfd 100644 (file)
 #  include <compface.h>
 #endif
 
-#if HAVE_LIBCOMPFACE
-#define XPM_XFACE_HEIGHT       (HEIGHT + 3)  /* 3 = 1 header + 2 colors */
-#endif
-
 #include "main.h"
 #include "summaryview.h"
 #include "procheader.h"