From 15d09ed57a83f20a8a6a6decf7aa5fd948c1315e Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Thu, 11 Oct 2018 15:25:00 +1000 Subject: [PATCH] Fix a couple of bugs, one in stralloc and one uninitialized ptr vector --- src/mail_menu.c | 2 ++ src/stralloc/stralloc.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mail_menu.c b/src/mail_menu.c index ac726a7..2f273f8 100644 --- a/src/mail_menu.c +++ b/src/mail_menu.c @@ -1454,6 +1454,8 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno uuid_t magi_msgid; struct ptr_vector msg_lines; + init_ptr_vector(&msg_lines); + jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path); if (!jb) { dolog("Error opening JAM base.. %s", conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path); diff --git a/src/stralloc/stralloc.c b/src/stralloc/stralloc.c index 180b2fe..10473ed 100644 --- a/src/stralloc/stralloc.c +++ b/src/stralloc/stralloc.c @@ -16,7 +16,7 @@ int stralloc_ready(stralloc *sa, size_t n) { sa->s = malloc(n); return sa != NULL; } - if (sa->a <= n) + if (sa->a >= n) return 1; na = 30 + n + (n >> 3); ns = realloc(sa->s, na);