static gboolean msgcache_msginfo_free_func(gpointer num, gpointer msginfo, gpointer user_data)
{
- procmsg_msginfo_free((MsgInfo *)msginfo);
+ procmsg_msginfo_free((MsgInfo **)&msginfo);
return TRUE;
}
if(msginfo->msgid)
g_hash_table_remove(cache->msgid_table, msginfo->msgid);
g_hash_table_remove(cache->msgnum_table, &msginfo->msgnum);
- procmsg_msginfo_free(msginfo);
- cache->last_access = time(NULL);
msginfo->folder->cache_dirty = TRUE;
+ procmsg_msginfo_free(&msginfo);
+ cache->last_access = time(NULL);
+
+
debug_print("Cache size: %d messages, %u bytes\n", g_hash_table_size(cache->msgnum_table), cache->memusage);
}
if (oldmsginfo) {
g_hash_table_remove(cache->msgnum_table, &oldmsginfo->msgnum);
cache->memusage -= procmsg_msginfo_memusage(oldmsginfo);
- procmsg_msginfo_free(oldmsginfo);
+ procmsg_msginfo_free(&oldmsginfo);
}
newmsginfo = procmsg_msginfo_new_ref(msginfo);
#define READ_CACHE_DATA(data, fp, total_len) \
{ \
if ((tmp_len = msgcache_read_cache_data_str(fp, &data, conv)) < 0) { \
- procmsg_msginfo_free(msginfo); \
+ procmsg_msginfo_free(&msginfo); \
error = TRUE; \
goto bail_err; \
} \
\
if ((ni = fread(&idata, sizeof(idata), 1, fp)) != 1) { \
g_warning("read_int: Cache data corrupted, read %zd of %zd at " \
- "offset %ld\n", ni, sizeof(idata), ftell(fp)); \
- procmsg_msginfo_free(msginfo); \
+ "offset %ld", ni, sizeof(idata), ftell(fp)); \
+ procmsg_msginfo_free(&msginfo); \
error = TRUE; \
goto bail_err; \
} else \
} \
if ((tmp_len = msgcache_get_cache_data_str(walk_data, &data, tmp_len, conv)) < 0) { \
g_print("error at rem_len:%d\n", rem_len);\
- procmsg_msginfo_free(msginfo); \
+ procmsg_msginfo_free(&msginfo); \
error = TRUE; \
goto bail_err; \
} \
WRITE_CACHE_DATA_INT(version, fp);
if (w_err != 0) {
- g_warning("failed to write int\n");
+ g_warning("failed to write int");
fclose(fp);
return NULL;
}
if ((ni = fread(&len, sizeof(len), 1, fp) != 1) ||
len > G_MAXINT) {
g_warning("read_data_str: Cache data (len) corrupted, read %zd "
- "of %zd bytes at offset %ld\n", ni, sizeof(len),
+ "of %zd bytes at offset %ld", ni, sizeof(len),
ftell(fp));
return -1;
}
if ((ni = fread(&len, sizeof(len), 1, fp) != 1) ||
bswap_32(len) > G_MAXINT) {
g_warning("read_data_str: Cache data (len) corrupted, read %zd "
- "of %zd bytes at offset %ld\n", ni, sizeof(len),
+ "of %zd bytes at offset %ld", ni, sizeof(len),
ftell(fp));
return -1;
}
if ((ni = fread(tmpstr, 1, len, fp)) != len) {
g_warning("read_data_str: Cache data corrupted, read %zd of %u "
- "bytes at offset %ld\n",
+ "bytes at offset %ld",
ni, len, ftell(fp));
g_free(tmpstr);
return -1;
return 0;
if(len > 2*1024*1024) {
- g_warning("read_data_str: refusing to allocate %d bytes.\n", len);
+ g_warning("read_data_str: refusing to allocate %d bytes.", len);
return -1;
}
}
if (w_err != 0) {
- g_warning("failed to write charset\n");
+ g_warning("failed to write charset");
if (write_fps.cache_fp)
fclose(write_fps.cache_fp);
claws_unlink(new_cache);