talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 3a84a64d03bb909fcbc084177c41befcc3d3dbf7
parent 20ad778b08831f0779847afe64fe881da177985d
Author: wwp <wwp@free.fr>
Date:   Sat, 21 Jan 2017 23:51:31 +0100

No need to test what g_malloc returns, as if it fails, it stops the
program.

Diffstat:
Msrc/codeconv.c | 1-
Msrc/messageview.c | 5+----
Msrc/plugins/libravatar/libravatar_missing.c | 10----------
Msrc/procheader.c | 13++-----------
4 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/src/codeconv.c b/src/codeconv.c @@ -784,7 +784,6 @@ gchar *conv_codeset_strdup(const gchar *inbuf, if (conv_func != conv_noconv) { len = (strlen(inbuf) + 1) * 3; buf = g_malloc(len); - if (!buf) return NULL; if (conv_func(buf, len, inbuf) == 0 || !strict_mode) return g_realloc(buf, strlen(buf) + 1); diff --git a/src/messageview.c b/src/messageview.c @@ -793,10 +793,7 @@ static void notification_convert_header(gchar **dest, return; } else { *dest = g_malloc(BUFFSIZE); - if (*dest) - conv_encode_header(*dest, BUFFSIZE, src, header_len, FALSE); - else - debug_print("notification_convert_header: alloc"); + conv_encode_header(*dest, BUFFSIZE, src, header_len, FALSE); } } diff --git a/src/plugins/libravatar/libravatar_missing.c b/src/plugins/libravatar/libravatar_missing.c @@ -57,12 +57,6 @@ GHashTable *missing_load_from_file(const gchar *filename) while ((r = fscanf(file, "%s %llu\n", md5sum, &seen)) != EOF) { if (t - (time_t)seen <= LIBRAVATAR_MISSING_TIME) { time_t *value = g_malloc0(sizeof(time_t)); - if (value == NULL) { - g_warning("cannot allocate memory"); - g_hash_table_destroy(table); - table = NULL; - goto close_exit; - } *value = (time_t)seen; g_hash_table_insert(table, g_strdup(md5sum), value); } else @@ -141,10 +135,6 @@ void missing_add_md5(GHashTable *table, const gchar *md5) time_t *seen = g_hash_table_lookup(table, md5); if (seen == NULL) { seen = g_malloc0(sizeof(time_t)); - if (seen == NULL) { - g_warning("cannot allocate memory"); - return; - } *seen = t; g_hash_table_insert(table, g_strdup(md5), seen); debug_print("New md5 %s added with time %llu\n", md5, (long long unsigned)t); diff --git a/src/procheader.c b/src/procheader.c @@ -139,11 +139,7 @@ static gint generic_get_one_field(gchar **bufptr, void *data, len = BUFFSIZE; buf = g_malloc(len); - if (buf == NULL) { - debug_print("generic_get_one_field: primary allocation error\n"); - *bufptr = NULL; - return -1; - } + if (hentry != NULL) { /* skip non-required headers */ /* and get hentry header line */ @@ -213,12 +209,7 @@ static gint generic_get_one_field(gchar **bufptr, void *data, /* read next line */ tmpbuf = g_malloc(BUFFSIZE); - if (tmpbuf == NULL) { - debug_print("generic_get_one_field: secondary allocation error\n"); - g_free(buf); - *bufptr = NULL; - return -1; - } + if (getline(tmpbuf, BUFFSIZE, data) == NULL) { g_free(tmpbuf); break;