jcs
/subtext
/amendments
/650
mail: Plug leaks
jcs made amendment 650 1 day ago
--- mail.c Sun Dec 7 11:57:13 2025
+++ mail.c Tue Sep 22 15:59:48 2026
@@ -512,7 +512,7 @@ void
mail_list(struct session *s, size_t nmail_ids, unsigned long *mail_ids,
size_t page, size_t pages)
{
- char time[10], from[40];
+ char time[10], from[50];
size_t n, size;
struct mail_message msg;
struct username_cache *user;
@@ -754,6 +754,8 @@ mail_save(struct mail_message *msg)
return bile_error(db->mail_bile);
}
+ xfree(&data);
+
return 0;
}
@@ -855,8 +857,13 @@ mail_find_ids_for_user(struct user *user, size_t *nret
*nret_mail_ids = nlimit_mail_ids;
done:
- if (failed)
+ if (failed) {
+ if (all_mail_ids != NULL)
+ xfree(&all_mail_ids);
+ if (mail_ids != NULL)
+ xfree(&mail_ids);
return 0;
+ }
return nmail_ids;
}
@@ -867,7 +874,7 @@ mail_toss_ftn_message(struct fidopkt_message *ftnmsg)
struct fidopkt_address our_address;
size_t n, nmail_ids, size;
unsigned long *mail_ids = NULL, sysop_id;
- struct mail_message msg;
+ struct mail_message msg = { 0 };
short ret = 1;
char *data;
@@ -969,6 +976,8 @@ mail_toss_ftn_message(struct fidopkt_message *ftnmsg)
ftnmsg->header.orig.node, ftnmsg->header.orig.point, to->username);
done:
+ if (msg.subject != NULL)
+ xfree(&msg.subject);
if (to != NULL)
xfree(&to);
return ret;