[BUG] in IMAP cache loading
- From: Emmanuel <e allaud wanadoo fr>
- To: ML de Balsa <balsa-list gnome org>
- Subject: [BUG] in IMAP cache loading
- Date: Sun, 10 Mar 2002 19:55:16 +0100
Hi all,
the following lines (from libbalsa/mailbox_imap.c) seem broken to me :
static gboolean
load_cache(LibBalsaMailbox* mailbox)
{
GDBM_FILE dbf;
datum key, nextkey, header;
LibBalsaMessage* message;
gchar* fname = get_cache_name(LIBBALSA_MAILBOX_IMAP(mailbox),
"headers");
dbf = gdbm_open(fname, 0, GDBM_READER, 0, NULL);
g_free(fname);
printf("Attempting to load data from cache for '%s'\n",
mailbox->name);
if(!dbf) return FALSE;
key = gdbm_firstkey(dbf);
while (key.dptr) {
header = gdbm_fetch(dbf, key);
message = message_from_header(header);
free(header.dptr);
libbalsa_mailbox_link_message(mailbox, message);
nextkey = gdbm_nextkey(dbf, key);
free(key.dptr); key = nextkey;
}
--> free(key.dptr);
gdbm_close(dbf);
return TRUE;
}
The line at the arrow should be removed or we will free a NULL-pointer
(indeed the while is over exactly when key.dptr is NULL). So it is at
least useless and at worst it will trigger a bug if free does not like
NULL-pointers.
Bye
Manu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]