From ticho at claws-mail.org Wed Apr 10 19:38:39 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Wed, 10 Apr 2019 19:38:39 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-144-g1efbdb3 Message-ID: <20190410173840.2BE582100316@mx.colino.net> The branch, master has been updated via 1efbdb3d9beea0137aeb304865dd061752a1e46f (commit) from 0c0a3c773b657bb80f4af3b7dbfd9646766bb526 (commit) Summary of changes: src/plugins/litehtml_viewer/lh_widget.cpp | 81 +++++++++++++++++++---------- src/plugins/litehtml_viewer/lh_widget.h | 6 ++- 2 files changed, 57 insertions(+), 30 deletions(-) - Log ----------------------------------------------------------------- commit 1efbdb3d9beea0137aeb304865dd061752a1e46f Author: Andrej Kacian Date: Wed Apr 10 19:37:38 2019 +0200 Make cursor and statusbar URL display smarter in litehtml plugin diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp index 64fdbdd..4e6d785 100644 --- a/src/plugins/litehtml_viewer/lh_widget.cpp +++ b/src/plugins/litehtml_viewer/lh_widget.cpp @@ -106,6 +106,8 @@ lh_widget::lh_widget() m_partinfo = NULL; + m_showing_url = FALSE; + gtk_widget_set_events(m_drawing_area, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK @@ -293,23 +295,35 @@ void lh_widget::clear() void lh_widget::set_cursor(const litehtml::tchar_t* cursor) { - if (cursor) { - if (m_cursor != cursor) { - m_cursor = cursor; - update_cursor(); + litehtml::element::ptr over_el; + gint x, y; + GdkWindow *w = gdk_display_get_window_at_pointer(gdk_display_get_default(), + &x, &y); + + if (w != gtk_widget_get_window(m_drawing_area)) + return; + + over_el = m_html->root()->get_element_by_point(x, y, x, y); + + if (!over_el) { + m_over_element = NULL; + return; + } + + if (cursor && over_el) { + if (over_el != m_over_element) { + m_over_element = over_el; + update_cursor(cursor); } } } -void lh_widget::update_cursor() +void lh_widget::update_cursor(const litehtml::tchar_t* cursor) { - gint x, y; const litehtml::tchar_t *href; - GdkWindow *w = gdk_display_get_window_at_pointer(gdk_display_get_default(), - &x, &y); GdkCursorType cursType = GDK_ARROW; - if (m_cursor == _t("pointer")) { + if (cursor == _t("pointer")) { cursType = GDK_HAND2; } @@ -319,47 +333,58 @@ void lh_widget::update_cursor() gdk_window_set_cursor(gtk_widget_get_window(m_drawing_area), gdk_cursor_new(cursType)); } - if (w != gtk_widget_get_window(m_drawing_area)) - return; - /* If it's an anchor, show its "href" attribute in statusbar, * otherwise clear statusbar. */ - if ((href = get_href_at(x, y)) != NULL) { - lh_widget_statusbar_push(fullurl(href).c_str()); - } else { + if (m_showing_url) { lh_widget_statusbar_pop(); + m_showing_url = FALSE; + } + + if ((href = get_href_at(m_over_element)) != NULL) { + lh_widget_statusbar_push(fullurl(href).c_str()); + m_showing_url = TRUE; } } -const litehtml::tchar_t *lh_widget::get_href_at(const gint x, const gint y) const +const litehtml::tchar_t *lh_widget::get_href_at(litehtml::element::ptr element) const { - litehtml::element::ptr over_el, el; + litehtml::element::ptr el; - if (m_html == NULL) - return NULL; - - over_el = m_html->root()->get_element_by_point(x, y, x, y); - if (over_el == NULL) + if (element == NULL) return NULL; /* If it's not an anchor, check if it has a parent anchor * (e.g. it's an image within an anchor) and grab a pointer * to that. */ - if (strcmp(over_el->get_tagName(), "a") && over_el->parent()) { - el = over_el->parent(); + if (strcmp(element->get_tagName(), "a") && element->parent()) { + el = element->parent(); while (el && el != m_html->root() && strcmp(el->get_tagName(), "a")) { el = el->parent(); } - if (el && el != m_html->root()) - over_el = el; - else + if (!el || el == m_html->root()) return NULL; + } else { + el = element; } /* At this point, over_el is pointing at an anchor tag, so let's * grab its href attribute. */ - return over_el->get_attr(_t("href")); + return el->get_attr(_t("href")); +} + +const litehtml::tchar_t *lh_widget::get_href_at(const gint x, const gint y) const +{ + litehtml::element::ptr over_el, el; + + if (m_html == NULL) + return NULL; + + over_el = m_html->root()->get_element_by_point(x, y, x, y); + if (over_el == NULL) + return NULL; + + return get_href_at(over_el); } void lh_widget::print() diff --git a/src/plugins/litehtml_viewer/lh_widget.h b/src/plugins/litehtml_viewer/lh_widget.h index e6b784a..9b95ef8 100644 --- a/src/plugins/litehtml_viewer/lh_widget.h +++ b/src/plugins/litehtml_viewer/lh_widget.h @@ -57,10 +57,11 @@ class lh_widget : public container_linux void redraw(gboolean force_render); void open_html(const gchar *contents); void clear(); - void update_cursor(); + void update_cursor(const litehtml::tchar_t* cursor); void update_font(); void print(); + const litehtml::tchar_t *get_href_at(litehtml::element::ptr element) const; const litehtml::tchar_t *get_href_at(const gint x, const gint y) const; void popup_context_menu(const litehtml::tchar_t *url, GdkEventButton *event); const litehtml::tstring fullurl(const litehtml::tchar_t *url) const; @@ -82,7 +83,8 @@ class lh_widget : public container_linux GtkWidget *m_context_menu; litehtml::context m_context; gint m_height; - litehtml::tstring m_cursor; + litehtml::element::ptr m_over_element; + gboolean m_showing_url; MimeInfo *m_partinfo; litehtml::tchar_t *m_font_name; ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From mir at datanom.net Wed Apr 10 20:11:05 2019 From: mir at datanom.net (Michael Rasmussen) Date: Wed, 10 Apr 2019 20:11:05 +0200 Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-144-g1efbdb3 In-Reply-To: <20190410173840.2BE582100316@mx.colino.net> References: <20190410173840.2BE582100316@mx.colino.net> Message-ID: <20190410201105.6f762c25@sleipner.datanom.net> On Wed, 10 Apr 2019 19:38:39 +0200 (CEST) ticho at claws-mail.org wrote: > ----------------------------------------------------------------- > commit 1efbdb3d9beea0137aeb304865dd061752a1e46f Author: Andrej Kacian > Date: Wed Apr 10 19:37:38 2019 +0200 > > Make cursor and statusbar URL display smarter in litehtml plugin > Are you sure this patch works as intended? Here the result is that the cursor newer changes from pointer to grabbing hand. -- Hilsen/Regards Michael Rasmussen Get my public GnuPG keys: michael rasmussen cc http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E mir datanom net http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C mir miras org http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917 -------------------------------------------------------------- /usr/games/fortune -es says: Your object is to save the world, while still leading a pleasant life. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From ticho at claws-mail.org Wed Apr 10 20:31:06 2019 From: ticho at claws-mail.org (Andrej Kacian) Date: Wed, 10 Apr 2019 20:31:06 +0200 Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-144-g1efbdb3 In-Reply-To: <20190410201105.6f762c25@sleipner.datanom.net> References: <20190410173840.2BE582100316@mx.colino.net> <20190410201105.6f762c25@sleipner.datanom.net> Message-ID: <20190410203106.7edb4338@penny> On Wed, 10 Apr 2019 20:11:05 +0200 Michael Rasmussen wrote: > On Wed, 10 Apr 2019 19:38:39 +0200 (CEST) > ticho at claws-mail.org wrote: > > > ----------------------------------------------------------------- > > commit 1efbdb3d9beea0137aeb304865dd061752a1e46f Author: Andrej Kacian > > Date: Wed Apr 10 19:37:38 2019 +0200 > > > > Make cursor and statusbar URL display smarter in litehtml plugin > > > Are you sure this patch works as intended? > Here the result is that the cursor newer changes from pointer to > grabbing hand. > Hm, you are right. I was focusing on the displayed URL being updated when several link elements are next to each other and missed this. Thanks, -- Andrej -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: From ticho at claws-mail.org Wed Apr 10 21:17:06 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Wed, 10 Apr 2019 21:17:06 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-146-g4e67984 Message-ID: <20190410191706.AAF7C2100316@mx.colino.net> The branch, master has been updated via 4e679846fdb066e5d764fdee3bf0ea7c195b2d00 (commit) via 6f95b7eeb6e5778ec0be8889041c1a33602ed3c8 (commit) from 1efbdb3d9beea0137aeb304865dd061752a1e46f (commit) Summary of changes: src/plugins/litehtml_viewer/lh_widget.cpp | 42 +++++++++-------------- src/plugins/litehtml_viewer/litehtml/document.h | 5 +++ 2 files changed, 21 insertions(+), 26 deletions(-) - Log ----------------------------------------------------------------- commit 4e679846fdb066e5d764fdee3bf0ea7c195b2d00 Author: Andrej Kacian Date: Wed Apr 10 21:00:01 2019 +0200 Fix incorrect logic in lh_widget::set_cursor(). diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp index 4e6d785..b02fa61 100644 --- a/src/plugins/litehtml_viewer/lh_widget.cpp +++ b/src/plugins/litehtml_viewer/lh_widget.cpp @@ -295,35 +295,31 @@ void lh_widget::clear() void lh_widget::set_cursor(const litehtml::tchar_t* cursor) { - litehtml::element::ptr over_el; + litehtml::element::ptr over_el = m_html->over_element(); gint x, y; - GdkWindow *w = gdk_display_get_window_at_pointer(gdk_display_get_default(), - &x, &y); - if (w != gtk_widget_get_window(m_drawing_area)) - return; - - over_el = m_html->root()->get_element_by_point(x, y, x, y); - - if (!over_el) { - m_over_element = NULL; - return; + if (m_showing_url && + (over_el == NULL || over_el != m_over_element)) { + lh_widget_statusbar_pop(); + m_showing_url = FALSE; } - if (cursor && over_el) { - if (over_el != m_over_element) { - m_over_element = over_el; - update_cursor(cursor); - } + if (over_el != m_over_element) { + m_over_element = over_el; + update_cursor(cursor); } } void lh_widget::update_cursor(const litehtml::tchar_t* cursor) { - const litehtml::tchar_t *href; GdkCursorType cursType = GDK_ARROW; + const litehtml::tchar_t *href = get_href_at(m_over_element); - if (cursor == _t("pointer")) { + /* If there is a href, and litehtml is okay with showing a pointer + * cursor ("pointer" or "auto"), set it, otherwise keep the + * default arrow cursor */ + if ((!strcmp(cursor, "pointer") || !strcmp(cursor, "auto")) && + href != NULL) { cursType = GDK_HAND2; } @@ -333,14 +329,8 @@ void lh_widget::update_cursor(const litehtml::tchar_t* cursor) gdk_window_set_cursor(gtk_widget_get_window(m_drawing_area), gdk_cursor_new(cursType)); } - /* If it's an anchor, show its "href" attribute in statusbar, - * otherwise clear statusbar. */ - if (m_showing_url) { - lh_widget_statusbar_pop(); - m_showing_url = FALSE; - } - - if ((href = get_href_at(m_over_element)) != NULL) { + /* If there is a href, show it in statusbar */ + if (href != NULL) { lh_widget_statusbar_push(fullurl(href).c_str()); m_showing_url = TRUE; } commit 6f95b7eeb6e5778ec0be8889041c1a33602ed3c8 Author: Andrej Kacian Date: Wed Apr 10 21:12:57 2019 +0200 Add a getter for litehtml::document's m_over_element member This allows us to avoid some expensive GDK calls in lh_widget::set_cursor(). diff --git a/src/plugins/litehtml_viewer/litehtml/document.h b/src/plugins/litehtml_viewer/litehtml/document.h index db30793..4484c92 100644 --- a/src/plugins/litehtml_viewer/litehtml/document.h +++ b/src/plugins/litehtml_viewer/litehtml/document.h @@ -90,6 +90,7 @@ namespace litehtml bool on_mouse_leave(position::vector& redraw_boxes); litehtml::element::ptr create_element(const tchar_t* tag_name, const string_map& attributes); element::ptr root(); + const element::ptr over_element() const; void get_fixed_boxes(position::vector& fixed_boxes); void add_fixed_box(const position& pos); void add_media_list(media_query_list::ptr list); @@ -115,6 +116,10 @@ namespace litehtml { return m_root; } + inline const element::ptr document::over_element() const + { + return m_over_element; + } inline void document::add_tabular(const element::ptr& el) { m_tabular_elements.push_back(el); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From mir at datanom.net Wed Apr 10 21:50:51 2019 From: mir at datanom.net (Michael Rasmussen) Date: Wed, 10 Apr 2019 21:50:51 +0200 Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-146-g4e67984 In-Reply-To: <20190410191706.AAF7C2100316@mx.colino.net> References: <20190410191706.AAF7C2100316@mx.colino.net> Message-ID: <20190410215051.384710f6@sleipner.datanom.net> On Wed, 10 Apr 2019 21:17:06 +0200 (CEST) ticho at claws-mail.org wrote: > ----------------------------------------------------------------- > commit 4e679846fdb066e5d764fdee3bf0ea7c195b2d00 Author: Andrej Kacian > Date: Wed Apr 10 21:00:01 2019 +0200 > > Fix incorrect logic in lh_widget::set_cursor(). > Yes, works now ;-) -- Hilsen/Regards Michael Rasmussen Get my public GnuPG keys: michael rasmussen cc http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E mir datanom net http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C mir miras org http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917 -------------------------------------------------------------- /usr/games/fortune -es says: If I could drop dead right now, I'd be the happiest man alive! -- Samuel Goldwyn -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From claws at claws-mail.org Sun Apr 21 12:44:08 2019 From: claws at claws-mail.org (claws at claws-mail.org) Date: Sun, 21 Apr 2019 12:44:08 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-147-g1a25c3d Message-ID: <20190421104408.585792100313@mx.colino.net> The branch, master has been updated via 1a25c3d8e2868e34a2c5f63d63958f4030dbb207 (commit) from 4e679846fdb066e5d764fdee3bf0ea7c195b2d00 (commit) Summary of changes: src/compose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) - Log ----------------------------------------------------------------- commit 1a25c3d8e2868e34a2c5f63d63958f4030dbb207 Author: Paul Date: Sun Apr 21 11:44:00 2019 +0100 fix bug 4167, 'Max line length exceeded when forwarding mail' diff --git a/src/compose.c b/src/compose.c index d2ca99c..3657a11 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2018 the Claws Mail team and Hiroyuki Yamamoto + * Copyright (C) 1999-2019 the Claws Mail team and Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -6469,7 +6469,7 @@ static int compose_add_attachments(Compose *compose, MimeInfo *parent) if (mimepart->type == MIMETYPE_MESSAGE || mimepart->type == MIMETYPE_MULTIPART) ainfo->encoding = ENC_BINARY; - else if (compose->use_signing) { + else if (compose->use_signing || compose->fwdinfo != NULL) { if (ainfo->encoding == ENC_7BIT) ainfo->encoding = ENC_QUOTED_PRINTABLE; else if (ainfo->encoding == ENC_8BIT) ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From claws at claws-mail.org Sun Apr 21 12:47:57 2019 From: claws at claws-mail.org (claws at claws-mail.org) Date: Sun, 21 Apr 2019 12:47:57 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-148-g25e32a8 Message-ID: <20190421104757.679982100313@mx.colino.net> The branch, master has been updated via 25e32a86ca83547a8326b47f1a256e23e309f7de (commit) from 1a25c3d8e2868e34a2c5f63d63958f4030dbb207 (commit) Summary of changes: src/folderview.c | 163 +++++++++++++++++++++--------------------------------- 1 file changed, 63 insertions(+), 100 deletions(-) - Log ----------------------------------------------------------------- commit 25e32a86ca83547a8326b47f1a256e23e309f7de Author: Paul Date: Sun Apr 21 11:47:50 2019 +0100 rework folderview styles fixes occasional crash on drag'n'drop of msgs. Patch by Andrej diff --git a/src/folderview.c b/src/folderview.c index 063c521..31bc048 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2018 Hiroyuki Yamamoto and the Claws Mail team + * Copyright (C) 1999-2019 the Claws Mail team and Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,11 +64,7 @@ static GList *folderview_list = NULL; -static GtkStyle *normal_style; -static GtkStyle *normal_color_style; static GtkStyle *bold_style; -static GtkStyle *bold_color_style; -static GtkStyle *bold_tgtfold_style; static GdkPixbuf *inboxxpm; static GdkPixbuf *inboxhrmxpm; @@ -659,12 +655,40 @@ FolderView *folderview_create(MainWindow *mainwin) return folderview; } -void folderview_init(FolderView *folderview) +static void folderview_set_fonts(FolderView *folderview) { + PangoFontDescription *font_desc; GtkWidget *ctree = folderview->ctree; - GdkColor gdk_color; - PangoFontDescription *normal_font; + font_desc = pango_font_description_from_string(NORMAL_FONT); + if (font_desc) { + gtk_widget_modify_font(ctree, font_desc); + pango_font_description_free(font_desc); + } + + if (!bold_style) { + bold_style = gtk_style_copy(gtk_widget_get_style(ctree)); + + if (prefs_common.derive_from_normal_font || !BOLD_FONT) { + font_desc = pango_font_description_from_string(NORMAL_FONT); + if (font_desc) { + pango_font_description_free(bold_style->font_desc); + bold_style->font_desc = font_desc; + } + pango_font_description_set_weight + (bold_style->font_desc, PANGO_WEIGHT_BOLD); + } else { + font_desc = pango_font_description_from_string(BOLD_FONT); + if (font_desc) { + pango_font_description_free(bold_style->font_desc); + bold_style->font_desc = font_desc; + } + } + } +} + +void folderview_init(FolderView *folderview) +{ stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_CLOSE, &inboxxpm); stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_CLOSE_HRM, &inboxhrmxpm); stock_pixbuf_gdk(STOCK_PIXMAP_INBOX_OPEN, &inboxopenxpm); @@ -717,56 +741,7 @@ void folderview_init(FolderView *folderview) stock_pixbuf_gdk(STOCK_PIXMAP_DIR_SUBS_CLOSE_MARK, &m_foldersubsxpm); stock_pixbuf_gdk(STOCK_PIXMAP_DIR_NOSELECT_CLOSE_MARK, &m_foldernoselectxpm); - normal_font = pango_font_description_from_string(NORMAL_FONT); - if (normal_font) { - gtk_widget_modify_font(ctree, normal_font); - pango_font_description_free(normal_font); - } - gtk_cmclist_set_row_height(GTK_CMCLIST(ctree), 0); - - if (!normal_style) { - PangoFontDescription *font_desc; - normal_style = gtk_style_copy(gtk_widget_get_style(ctree)); - font_desc = pango_font_description_from_string(NORMAL_FONT); - if (font_desc) { - if (normal_style->font_desc) - pango_font_description_free - (normal_style->font_desc); - normal_style->font_desc = font_desc; - } - gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], &gdk_color); - normal_color_style = gtk_style_copy(normal_style); - normal_color_style->text[GTK_STATE_NORMAL] = gdk_color; - } - - if (!bold_style) { - gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], &gdk_color); - bold_style = gtk_style_copy(gtk_widget_get_style(ctree)); - if (prefs_common.derive_from_normal_font || !BOLD_FONT) { - PangoFontDescription *font_desc; - font_desc = pango_font_description_from_string(NORMAL_FONT); - if (font_desc) { - pango_font_description_free(bold_style->font_desc); - bold_style->font_desc = font_desc; - } - pango_font_description_set_weight - (bold_style->font_desc, PANGO_WEIGHT_BOLD); - } else { - PangoFontDescription *font_desc; - font_desc = pango_font_description_from_string(BOLD_FONT); - if (font_desc) { - if (bold_style->font_desc) - pango_font_description_free - (bold_style->font_desc); - bold_style->font_desc = font_desc; - } - } - bold_color_style = gtk_style_copy(bold_style); - bold_color_style->text[GTK_STATE_NORMAL] = gdk_color; - - bold_tgtfold_style = gtk_style_copy(bold_style); - bold_tgtfold_style->text[GTK_STATE_NORMAL] = folderview->color_op; - } + folderview_set_fonts(folderview); } static gboolean folderview_defer_set(gpointer data) @@ -1534,8 +1509,7 @@ static gboolean folderview_have_marked_children(FolderView *folderview, static void folderview_update_node(FolderView *folderview, GtkCMCTreeNode *node) { GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree); - GtkStyle *style = NULL; - GtkStyle *color_style = NULL; + GtkStyle *style = NULL, *prev_style; FolderItem *item; GdkPixbuf *xpm, *openxpm; static GdkPixbuf *searchicon; @@ -1547,7 +1521,7 @@ static void folderview_update_node(FolderView *folderview, GtkCMCTreeNode *node) gboolean use_bold, use_color; gint *col_pos = folderview->col_pos; SpecialFolderItemType stype; - gboolean copiedstyle = FALSE; + GdkColor gdk_color; item = gtk_cmctree_node_get_row_data(ctree, node); cm_return_if_fail(item != NULL); @@ -1752,41 +1726,36 @@ static void folderview_update_node(FolderView *folderview, GtkCMCTreeNode *node) gtk_cmctree_node_set_foreground(ctree, node, NULL); if (use_bold) { - GdkColor gdk_color; - - if (item->prefs->color > 0 && !use_color) { + style = bold_style; + if (use_color) { + gtk_cmctree_node_set_foreground(ctree, node, &folderview->color_new); + } else if (item->op_count > 0) { + gtk_cmctree_node_set_foreground(ctree, node, &folderview->color_op); + } else if (item->prefs->color != 0) { gtkut_convert_int_to_gdk_color(item->prefs->color, &gdk_color); - color_style = gtk_style_copy(bold_style); - copiedstyle = TRUE; - color_style->text[GTK_STATE_NORMAL] = gdk_color; - style = color_style; - } else if (use_color) { - style = bold_color_style; - } else - style = bold_style; - if (item->op_count > 0) { - style = bold_tgtfold_style; + gtk_cmctree_node_set_foreground(ctree, node, &gdk_color); } } else if (use_color) { - style = normal_color_style; - gtk_cmctree_node_set_foreground(ctree, node, - &folderview->color_new); + gtk_cmctree_node_set_foreground(ctree, node, &folderview->color_new); } else if (item->op_count > 0) { - style = bold_tgtfold_style; - } else if (item->prefs->color > 0) { - GdkColor gdk_color; + gtk_cmctree_node_set_foreground(ctree, node, &folderview->color_op); + } else if (item->prefs->color != 0) { gtkut_convert_int_to_gdk_color(item->prefs->color, &gdk_color); - color_style = gtk_style_copy(normal_style); - copiedstyle = TRUE; - color_style->text[GTK_STATE_NORMAL] = gdk_color; - style = color_style; - } else { - style = normal_style; + gtk_cmctree_node_set_foreground(ctree, node, &gdk_color); } gtk_cmctree_node_set_row_style(ctree, node, style); - if (copiedstyle) + + prev_style = gtk_cmctree_node_get_row_style(ctree, node); + if (prev_style) { + GtkStyle *ctree_style = gtk_widget_get_style(GTK_WIDGET(ctree)); + + style = gtk_style_copy(prev_style); + style->text[GTK_STATE_NORMAL] = ctree_style->text[GTK_STATE_NORMAL]; + style->text[GTK_STATE_SELECTED] = ctree_style->text[GTK_STATE_SELECTED]; + gtk_cmctree_node_set_row_style(ctree, node, style); g_object_unref(style); + } if ((node = gtkut_ctree_find_collapsed_parent(ctree, node)) != NULL) folderview_update_node(folderview, node); @@ -2483,8 +2452,6 @@ static void folderview_create_folder_node(FolderView *folderview, FolderItem *it FALSE, FALSE); gtk_cmctree_expand(ctree, parent_node); gtk_cmctree_node_set_row_data(ctree, node, item); - if (normal_style) - gtk_cmctree_node_set_row_style(ctree, node, normal_style); folderview_sort_folders(folderview, parent_node, item->folder); hookdata.item = item; @@ -2780,18 +2747,12 @@ static void folderview_processing_cb(GtkAction *action, gpointer data) void folderview_set_target_folder_color(gint color_op) { - gint firstone = 1; GList *list; FolderView *folderview; for (list = folderview_list; list != NULL; list = list->next) { folderview = (FolderView *)list->data; gtkut_convert_int_to_gdk_color(color_op, &folderview->color_op); - if (firstone) { - bold_tgtfold_style->text[GTK_STATE_NORMAL] = - folderview->color_op; - firstone = 0; - } } } @@ -2820,6 +2781,11 @@ void folderview_reflect_prefs(void) GTK_SCROLLED_WINDOW(folderview->scrolledwin)); gint height = gtk_adjustment_get_value(pos); + gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], + &folderview->color_new); + gtkut_convert_int_to_gdk_color(prefs_common.color[COL_TGT_FOLDER], + &folderview->color_op); + if (!last_smallfont || strcmp(last_smallfont, SMALL_FONT) || !last_normalfont || strcmp(last_normalfont, NORMAL_FONT) || !last_boldfont || strcmp(last_boldfont, BOLD_FONT) || @@ -2843,15 +2809,12 @@ void folderview_reflect_prefs(void) s = NULL; \ } - STYLE_FREE(normal_style); - STYLE_FREE(normal_color_style); STYLE_FREE(bold_style); - STYLE_FREE(bold_color_style); - STYLE_FREE(bold_tgtfold_style); #undef STYLE_FREE - folderview_init(folderview); + folderview_set_fonts(folderview); + gtk_cmclist_freeze(GTK_CMCLIST(folderview->ctree)); folderview_column_set_titles(folderview); folderview_set_all(); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Mon Apr 22 13:07:37 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Mon, 22 Apr 2019 13:07:37 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-149-g76b904c Message-ID: <20190422110737.A70952100317@mx.colino.net> The branch, master has been updated via 76b904c233f6565a9002bdb0be4e00115a0278d7 (commit) from 25e32a86ca83547a8326b47f1a256e23e309f7de (commit) Summary of changes: src/plugins/rssyl/libfeed/feeditem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit 76b904c233f6565a9002bdb0be4e00115a0278d7 Author: Andrej Kacian Date: Mon Apr 22 11:37:27 2019 +0200 Fix memory leak in RSSyl's feed_item_free() diff --git a/src/plugins/rssyl/libfeed/feeditem.c b/src/plugins/rssyl/libfeed/feeditem.c index a85852e..340cbf5 100644 --- a/src/plugins/rssyl/libfeed/feeditem.c +++ b/src/plugins/rssyl/libfeed/feeditem.c @@ -80,7 +80,7 @@ void feed_item_free(FeedItem *item) g_free(item->data); g_free(item->comments_url); g_free(item->parent_id); - g_free(item->enclosure); + feed_item_enclosure_free(item->enclosure); g_free(item->sourcetitle); g_free(item->sourceid); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Mon Apr 22 13:07:45 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Mon, 22 Apr 2019 13:07:45 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-150-gcc60626 Message-ID: <20190422110745.62C272100319@mx.colino.net> The branch, master has been updated via cc60626486ae41a9bfd52e9ef1edbb2ab89d5539 (commit) from 76b904c233f6565a9002bdb0be4e00115a0278d7 (commit) Summary of changes: src/plugins/rssyl/rssyl_deleted.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit cc60626486ae41a9bfd52e9ef1edbb2ab89d5539 Author: Andrej Kacian Date: Mon Apr 22 12:58:59 2019 +0200 Fix a memory leak in rssyl_deleted_expire() diff --git a/src/plugins/rssyl/rssyl_deleted.c b/src/plugins/rssyl/rssyl_deleted.c index a264365..5d1bbfc 100644 --- a/src/plugins/rssyl/rssyl_deleted.c +++ b/src/plugins/rssyl/rssyl_deleted.c @@ -370,8 +370,9 @@ void rssyl_deleted_expire(RFolderItem *ritem, Feed *feed) debug_print("RSSyl: (DELETED) removing '%s' from list\n", ditem->title); d2 = d->next; ritem->deleted_items = g_slist_remove_link(ritem->deleted_items, d); + _free_deleted_item(ditem, NULL); + g_slist_free(d); d = d2; - continue; } else { d = d->next; } ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Mon Apr 22 13:07:53 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Mon, 22 Apr 2019 13:07:53 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-151-gd4d8239 Message-ID: <20190422110753.6B2E12100318@mx.colino.net> The branch, master has been updated via d4d8239c2fb85aa79bb348cc62ee78a57f187136 (commit) from cc60626486ae41a9bfd52e9ef1edbb2ab89d5539 (commit) Summary of changes: src/stock_pixmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) - Log ----------------------------------------------------------------- commit d4d8239c2fb85aa79bb348cc62ee78a57f187136 Author: Andrej Kacian Date: Mon Apr 22 13:06:19 2019 +0200 Fix a memory leak in stock_pixmap_widget_with_overlay() diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c index 181d4ca..44b278a 100644 --- a/src/stock_pixmap.c +++ b/src/stock_pixmap.c @@ -1077,6 +1077,8 @@ GtkWidget *stock_pixmap_widget_with_overlay(StockPixmap icon, data->overlay_pixmap = NULL; } else { stock_wid = stock_pixmap_widget(overlay); + g_object_ref_sink(stock_wid); + cr = gdk_cairo_create(gtk_widget_get_window(stock_wid)); stock_pixmap = cairo_get_target(cr); cairo_surface_reference(stock_pixmap); @@ -1085,7 +1087,7 @@ GtkWidget *stock_pixmap_widget_with_overlay(StockPixmap icon, data->overlay_height = requisition.height; data->overlay_width = requisition.width; - gtk_widget_destroy(stock_wid); + g_object_unref(stock_wid); } } else { data->is_pixmap = FALSE; @@ -1099,13 +1101,15 @@ GtkWidget *stock_pixmap_widget_with_overlay(StockPixmap icon, data->overlay_pixmap = NULL; } else { stock_wid = stock_pixmap_widget(overlay); + g_object_ref_sink(stock_wid); + stock_pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(stock_wid)); g_object_ref(stock_pixbuf); data->overlay_pixbuf = stock_pixbuf; data->overlay_height = requisition.height; data->overlay_width = requisition.width; - gtk_widget_destroy(stock_wid); + g_object_unref(stock_wid); } } data->position = pos; ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Tue Apr 23 22:31:39 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Tue, 23 Apr 2019 22:31:39 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-152-g984d5ed Message-ID: <20190423203139.F2A042100314@mx.colino.net> The branch, master has been updated via 984d5ed3aca6d87c6e42196ae8ed71b936f6e980 (commit) from d4d8239c2fb85aa79bb348cc62ee78a57f187136 (commit) Summary of changes: src/plugins/rssyl/rssyl_add_item.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) - Log ----------------------------------------------------------------- commit 984d5ed3aca6d87c6e42196ae8ed71b936f6e980 Author: Andrej Kacian Date: Tue Apr 23 22:31:31 2019 +0200 Fix a memory leak in rssyl_add_item() diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c index 4123008..2bff270 100644 --- a/src/plugins/rssyl/rssyl_add_item.c +++ b/src/plugins/rssyl/rssyl_add_item.c @@ -379,6 +379,7 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item) atoi(pathbasename)); g_free(pathbasename); oldperm_flags = msginfo->flags.perm_flags; + procmsg_msginfo_free(&msginfo); ritem->items = g_slist_remove(ritem->items, old_item); if (g_unlink(ctx->path) != 0) { @@ -575,9 +576,11 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item) * doesn't want to see it unread because of the change. */ if (dif != EXISTS_NEW) { if (!(oldperm_flags & MSG_UNREAD) && (ritem->silent_update == 2 - || (ritem->silent_update == 1 && dif == EXISTS_CHANGED_TEXTONLY))) - procmsg_msginfo_unset_flags( - folder_item_get_msginfo((FolderItem *)ritem, d), MSG_NEW | MSG_UNREAD, 0); + || (ritem->silent_update == 1 && dif == EXISTS_CHANGED_TEXTONLY))) { + msginfo = folder_item_get_msginfo((FolderItem *)ritem, d); + procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0); + procmsg_msginfo_free(&msginfo); + } } debug_print("RSSyl: folder_item_add_msg(): %d\n", d); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Tue Apr 23 23:46:50 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Tue, 23 Apr 2019 23:46:50 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-153-g8101fa7 Message-ID: <20190423214651.014322100313@mx.colino.net> The branch, master has been updated via 8101fa7f5c1e01f3d7b9e2aa6873cf490f610a7b (commit) from 984d5ed3aca6d87c6e42196ae8ed71b936f6e980 (commit) Summary of changes: src/plugins/rssyl/rssyl.c | 1 + 1 file changed, 1 insertion(+) - Log ----------------------------------------------------------------- commit 8101fa7f5c1e01f3d7b9e2aa6873cf490f610a7b Author: Andrej Kacian Date: Tue Apr 23 23:46:43 2019 +0200 Fix a memory leak in rssyl_rename_folder() diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c index fdd1816..410b536 100644 --- a/src/plugins/rssyl/rssyl.c +++ b/src/plugins/rssyl/rssyl.c @@ -591,6 +591,7 @@ static gint rssyl_rename_folder(Folder *folder, FolderItem *item, dirname = g_path_get_dirname(oldpath); basenewpath = g_strdelimit(g_strdup(name), G_DIR_SEPARATOR_S, '_'); newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, basenewpath, NULL); + g_free(dirname); g_free(basenewpath); if( g_rename(oldpath, newpath) < 0 ) { ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Tue Apr 23 23:58:50 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Tue, 23 Apr 2019 23:58:50 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-154-g0c330bd Message-ID: <20190423215850.CB8AD2100313@mx.colino.net> The branch, master has been updated via 0c330bd1e1f5ce77e160f46f06ba3431bbc5d921 (commit) from 8101fa7f5c1e01f3d7b9e2aa6873cf490f610a7b (commit) Summary of changes: src/plugins/pgpmime/pgpmime.c | 3 +++ 1 file changed, 3 insertions(+) - Log ----------------------------------------------------------------- commit 0c330bd1e1f5ce77e160f46f06ba3431bbc5d921 Author: Andrej Kacian Date: Tue Apr 23 23:58:22 2019 +0200 Fix memory leaks in pgpmime_sign() and pgpmime_encrypt() diff --git a/src/plugins/pgpmime/pgpmime.c b/src/plugins/pgpmime/pgpmime.c index 61eed9b..539c2f8 100644 --- a/src/plugins/pgpmime/pgpmime.c +++ b/src/plugins/pgpmime/pgpmime.c @@ -601,6 +601,7 @@ gboolean pgpmime_sign(MimeInfo *mimeinfo, PrefsAccount *account, const gchar *fr newinfo->data.mem = g_malloc(len + 1); g_memmove(newinfo->data.mem, sigcontent, len); newinfo->data.mem[len] = '\0'; + newinfo->tmp = TRUE; g_node_append(sigmultipart->node, newinfo->node); g_free(sigcontent); @@ -736,6 +737,7 @@ gboolean pgpmime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data) newinfo->subtype = g_strdup("pgp-encrypted"); newinfo->content = MIMECONTENT_MEM; newinfo->data.mem = g_strdup("Version: 1\n"); + newinfo->tmp = TRUE; g_node_append(encmultipart->node, newinfo->node); newinfo = procmime_mimeinfo_new(); @@ -743,6 +745,7 @@ gboolean pgpmime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data) newinfo->subtype = g_strdup("octet-stream"); newinfo->content = MIMECONTENT_MEM; newinfo->data.mem = g_malloc(len + 1); + newinfo->tmp = TRUE; g_memmove(newinfo->data.mem, enccontent, len); newinfo->data.mem[len] = '\0'; g_node_append(encmultipart->node, newinfo->node); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Wed Apr 24 00:05:06 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Wed, 24 Apr 2019 00:05:06 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-155-g18bd82c Message-ID: <20190423220506.D9D902100313@mx.colino.net> The branch, master has been updated via 18bd82c8d833626d0edf033c9b313cfe7efe9a6e (commit) from 0c330bd1e1f5ce77e160f46f06ba3431bbc5d921 (commit) Summary of changes: src/plugins/smime/smime.c | 2 ++ 1 file changed, 2 insertions(+) - Log ----------------------------------------------------------------- commit 18bd82c8d833626d0edf033c9b313cfe7efe9a6e Author: Andrej Kacian Date: Wed Apr 24 00:03:27 2019 +0200 Fix memory leak in smime_sign() and forgotten removal of a temporary file in smime_encrypt() diff --git a/src/plugins/smime/smime.c b/src/plugins/smime/smime.c index f0cd96f..fd50f1e 100644 --- a/src/plugins/smime/smime.c +++ b/src/plugins/smime/smime.c @@ -691,6 +691,7 @@ gboolean smime_sign(MimeInfo *mimeinfo, PrefsAccount *account, const gchar *from g_hash_table_insert(newinfo->dispositionparameters, g_strdup("filename"), g_strdup("smime.p7s")); newinfo->data.mem = g_malloc(len + 1); + newinfo->tmp = TRUE; g_memmove(newinfo->data.mem, real_content, len); newinfo->data.mem[len] = '\0'; newinfo->encoding_type = ENC_BASE64; @@ -869,6 +870,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data) encmultipart->content = MIMECONTENT_FILE; encmultipart->data.filename = tmpfile; + encmultipart->tmp = TRUE; procmime_encode_content(encmultipart, ENC_BASE64); g_free(enccontent); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Wed Apr 24 07:58:30 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Wed, 24 Apr 2019 07:58:30 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-156-g9cdf381 Message-ID: <20190424055831.06B1C2100313@mx.colino.net> The branch, master has been updated via 9cdf381a9a7bfefde0957531a2972b3e05ba0947 (commit) from 18bd82c8d833626d0edf033c9b313cfe7efe9a6e (commit) Summary of changes: src/plugins/rssyl/rssyl_update_feed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit 9cdf381a9a7bfefde0957531a2972b3e05ba0947 Author: Andrej Kacian Date: Wed Apr 24 07:57:47 2019 +0200 Fix a blatant textbook case of use-after-free in rssyl_update_feed() diff --git a/src/plugins/rssyl/rssyl_update_feed.c b/src/plugins/rssyl/rssyl_update_feed.c index e0ad115..31b4228 100644 --- a/src/plugins/rssyl/rssyl_update_feed.c +++ b/src/plugins/rssyl/rssyl_update_feed.c @@ -256,7 +256,7 @@ gboolean rssyl_update_feed(RFolderItem *ritem, RSSylVerboseFlags verbose) g_free(ctx->error); g_free(ctx); STATUSBAR_POP(mainwin); - return ctx->success; + return FALSE; } rssyl_deleted_update(ritem); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 00:20:17 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 00:20:17 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-157-g6023fa2 Message-ID: <20190424222017.E91292100313@mx.colino.net> The branch, master has been updated via 6023fa27735149267d4951b318720227deb231cb (commit) from 9cdf381a9a7bfefde0957531a2972b3e05ba0947 (commit) Summary of changes: src/action.c | 8 ++++++++ src/summaryview.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit 6023fa27735149267d4951b318720227deb231cb Author: Andrej Kacian Date: Thu Apr 25 00:13:35 2019 +0200 Fix a long-standing use-after-free in mainwin_actions_execute() message_actions_execute() eventually calls summary_show() to redisplay current folder in summaryview. This causes a summary_clear(), which frees all MsgInfos from the local linked list in mainwin_actions_execute(). This list is then used to restore summaryview selection, but at this point, all its members point to already freed memory. We solve this by increasing each MsgInfo's reference count, so that they do not get freed, and we free them after we're done with them. Note: procmsg_msginfo_free() should probably be renamed to procmsg_msginfo_unref() diff --git a/src/action.c b/src/action.c index 8285027..b975f8e 100644 --- a/src/action.c +++ b/src/action.c @@ -620,6 +620,13 @@ static void mainwin_actions_execute_cb(GtkWidget *widget, gpointer data) mainwin_actions_execute(mainwin, action_nb, NULL); } +static void _free_msginfos(gpointer data, gpointer user_data) +{ + MsgInfo *msginfo = (MsgInfo *)data; + + procmsg_msginfo_free(&msginfo); +} + static void mainwin_actions_execute(MainWindow *mainwin, guint action_nb, GtkWidget *widget) { @@ -628,6 +635,7 @@ static void mainwin_actions_execute(MainWindow *mainwin, guint action_nb, msg_list = summary_get_selected_msg_list(mainwin->summaryview); message_actions_execute(mainwin->messageview, action_nb, msg_list); summary_select_by_msg_list(mainwin->summaryview, msg_list); + g_slist_foreach(msg_list, _free_msginfos, NULL); g_slist_free(msg_list); } diff --git a/src/summaryview.c b/src/summaryview.c index d7b4440..d03d1b7 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1798,7 +1798,8 @@ GSList *summary_get_selected_msg_list(SummaryView *summaryview) for (cur = GTK_CMCLIST(summaryview->ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) { msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(cur->data); - mlist = g_slist_prepend(mlist, msginfo); + mlist = g_slist_prepend(mlist, + procmsg_msginfo_new_ref(msginfo)); } mlist = g_slist_reverse(mlist); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 01:05:16 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 01:05:16 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-158-gad05509 Message-ID: <20190424230517.122E62100313@mx.colino.net> The branch, master has been updated via ad0550981b5cc3ec9105cdc847cb659eed759e34 (commit) from 6023fa27735149267d4951b318720227deb231cb (commit) Summary of changes: src/mimeview.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit ad0550981b5cc3ec9105cdc847cb659eed759e34 Author: Andrej Kacian Date: Thu Apr 25 01:04:59 2019 +0200 Fix a memory leak in icon_list_append_icon() diff --git a/src/mimeview.c b/src/mimeview.c index b697d52..7e28330 100644 --- a/src/mimeview.c +++ b/src/mimeview.c @@ -2624,8 +2624,12 @@ static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo) g_free(escaped); } if (sigshort && *sigshort) { - tiptmp = g_strjoin("\n", tip, g_markup_escape_text(sigshort, -1), NULL); + gchar *sigshort_escaped = + g_markup_escape_text(sigshort, -1); + + tiptmp = g_strjoin("\n", tip, sigshort_escaped, NULL); g_free(tip); + g_free(sigshort_escaped); tip = tiptmp; } g_free(sigshort); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 01:10:43 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 01:10:43 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-159-gd172180 Message-ID: <20190424231043.741FD2100313@mx.colino.net> The branch, master has been updated via d17218031565b6ab8e78ab5d24f1b16b0fa3f848 (commit) from ad0550981b5cc3ec9105cdc847cb659eed759e34 (commit) Summary of changes: src/plugins/pgpcore/sgpgme.c | 4 ++++ 1 file changed, 4 insertions(+) - Log ----------------------------------------------------------------- commit d17218031565b6ab8e78ab5d24f1b16b0fa3f848 Author: Andrej Kacian Date: Thu Apr 25 01:10:36 2019 +0200 Fix a memory leak in sgpgme_sigstat_info_short() diff --git a/src/plugins/pgpcore/sgpgme.c b/src/plugins/pgpcore/sgpgme.c index 79c0c92..3d056e9 100644 --- a/src/plugins/pgpcore/sgpgme.c +++ b/src/plugins/pgpcore/sgpgme.c @@ -310,6 +310,10 @@ gchar *sgpgme_sigstat_info_short(gpgme_ctx_t ctx, gpgme_verify_result_t status) if (result == NULL) result = g_strdup(_("Error")); g_free(uname); + + if (key) + gpgme_key_release(key); + return result; } ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 21:39:07 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 21:39:07 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-160-gdc6f615 Message-ID: <20190425193907.E1B062100313@mx.colino.net> The branch, master has been updated via dc6f61518909b5ada650a4ae922276cd814f0cce (commit) from d17218031565b6ab8e78ab5d24f1b16b0fa3f848 (commit) Summary of changes: src/plugins/rssyl/rssyl.c | 2 +- src/plugins/rssyl/rssyl_add_item.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) - Log ----------------------------------------------------------------- commit dc6f61518909b5ada650a4ae922276cd814f0cce Author: Andrej Kacian Date: Thu Apr 25 21:38:10 2019 +0200 Fix a memory leak in rssyl_add_item() diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c index 410b536..e6cc6e3 100644 --- a/src/plugins/rssyl/rssyl.c +++ b/src/plugins/rssyl/rssyl.c @@ -811,7 +811,7 @@ static gint rssyl_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list, return dest->last_num; } -static gint rssyl_add_msg(Folder *folder, FolderItem *dest, const gchar *file, +gint rssyl_add_msg(Folder *folder, FolderItem *dest, const gchar *file, MsgFlags *flags) { GSList file_list; diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c index 2bff270..d22e1dd 100644 --- a/src/plugins/rssyl/rssyl_add_item.c +++ b/src/plugins/rssyl/rssyl_add_item.c @@ -46,6 +46,9 @@ #include "rssyl_parse_feed.h" #include "strutils.h" +gint rssyl_add_msg(Folder *folder, FolderItem *dest, const gchar *file, + MsgFlags *flags); + /* rssyl_cb_feed_compare() * * GCompareFunc function called by glib2's g_slist_find_custom(). @@ -560,10 +563,15 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item) flags->perm_flags = MSG_NEW | MSG_UNREAD; flags->tmp_flags = 0; - d = folder_item_add_msg(&ritem->item, template, flags, TRUE); - g_free(template); + d = rssyl_add_msg(ritem->item.folder, &ritem->item, template, flags); + g_free(flags); + if (claws_unlink(template) < 0) + FILE_OP_ERROR(template, "unlink"); + + g_free(template); + ctx = g_new0(RFeedCtx, 1); ctx->path = (gpointer)g_strdup_printf("%s%c%d", dirname, G_DIR_SEPARATOR, d); @@ -583,5 +591,5 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item) } } - debug_print("RSSyl: folder_item_add_msg(): %d\n", d); + debug_print("RSSyl: rssyl_add_msg(): %d\n", d); } ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 22:22:47 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 22:22:47 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-161-g24d8ebd Message-ID: <20190425202247.DDBD42100313@mx.colino.net> The branch, master has been updated via 24d8ebd06b2740620118550ebc73af45b8392415 (commit) from dc6f61518909b5ada650a4ae922276cd814f0cce (commit) Summary of changes: src/procmime.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit 24d8ebd06b2740620118550ebc73af45b8392415 Author: Andrej Kacian Date: Thu Apr 25 22:20:06 2019 +0200 Fix a runaway string read in procmime_decode_content() We initialize output buffer for g_base64_decode_step() to zeroes, so that we can later call strlen() on it safely. We also allocate one byte more than we write, so that the trailing zero byte is guaranteed to be there. diff --git a/src/procmime.c b/src/procmime.c index 2be6961..a5961b7 100644 --- a/src/procmime.c +++ b/src/procmime.c @@ -366,7 +366,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo) if (flowed) FLUSH_LASTLINE(); } else if (encoding == ENC_BASE64) { - gchar outbuf[BUFFSIZE]; + gchar outbuf[BUFFSIZE + 1]; gint len, inlen, inread; gboolean got_error = FALSE; gboolean uncanonicalize = FALSE; @@ -390,6 +390,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo) while ((inlen = MIN(readend - ftell(infp), sizeof(buf))) > 0 && !err) { inread = claws_fread(buf, 1, inlen, infp); + memset(outbuf, 0, sizeof(buf)); len = g_base64_decode_step(buf, inlen, outbuf, &state, &save); if (uncanonicalize == TRUE && strlen(outbuf) < len && starting) { uncanonicalize = FALSE; ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 22:40:59 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 22:40:59 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-162-gf544f20 Message-ID: <20190425204059.5F5472100313@mx.colino.net> The branch, master has been updated via f544f20bb21e729c67b219e8d707177cbf96ff3e (commit) from 24d8ebd06b2740620118550ebc73af45b8392415 (commit) Summary of changes: src/plugins/litehtml_viewer/container_linux_images.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit f544f20bb21e729c67b219e8d707177cbf96ff3e Author: Andrej Kacian Date: Thu Apr 25 22:40:31 2019 +0200 Fix a memory leak in litehtml plugin's container_linux::load_image() diff --git a/src/plugins/litehtml_viewer/container_linux_images.cpp b/src/plugins/litehtml_viewer/container_linux_images.cpp index 5c6f7f6..5ef7c0c 100644 --- a/src/plugins/litehtml_viewer/container_linux_images.cpp +++ b/src/plugins/litehtml_viewer/container_linux_images.cpp @@ -109,7 +109,7 @@ void container_linux::load_image( const litehtml::tchar_t* src, const litehtml:: unlock_images_cache(); if (!found) { - struct FetchCtx *ctx = g_new(struct FetchCtx, 1); + struct FetchCtx *ctx; /* Attached images can be loaded into cache right here. */ if (!strncmp(src, "cid:", 4)) { @@ -128,6 +128,7 @@ void container_linux::load_image( const litehtml::tchar_t* src, const litehtml:: debug_print("allowing download of image from '%s'\n", src); + ctx = g_new(struct FetchCtx, 1); ctx->url = g_strdup(url.c_str()); ctx->container = this; ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 23:17:07 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 23:17:07 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-163-g969c422 Message-ID: <20190425211707.9B9E42100313@mx.colino.net> The branch, master has been updated via 969c422ede326adee17bf5009a0c55c687ef1f6f (commit) from f544f20bb21e729c67b219e8d707177cbf96ff3e (commit) Summary of changes: src/plugins/litehtml_viewer/lh_viewer.c | 9 +++------ src/plugins/litehtml_viewer/lh_widget.cpp | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) - Log ----------------------------------------------------------------- commit 969c422ede326adee17bf5009a0c55c687ef1f6f Author: Andrej Kacian Date: Thu Apr 25 23:16:53 2019 +0200 Fix two memory leaks in litehtml plugin diff --git a/src/plugins/litehtml_viewer/lh_viewer.c b/src/plugins/litehtml_viewer/lh_viewer.c index cf22959..a567d2c 100644 --- a/src/plugins/litehtml_viewer/lh_viewer.c +++ b/src/plugins/litehtml_viewer/lh_viewer.c @@ -107,13 +107,10 @@ static void lh_clear_viewer(MimeViewer *_viewer) static void lh_destroy_viewer(MimeViewer *_viewer) { - debug_print("LH: destroy_viewer\n"); - - /* Just in case. */ - lh_clear_viewer(_viewer); + LHViewer *viewer = (LHViewer *)_viewer; -// LHViewer *viewer = (LHViewer *)_viewer; -// lh_widget_destroy(viewer->widget); + debug_print("LH: destroy_viewer\n"); + g_free(viewer); } static void lh_print_viewer (MimeViewer *_viewer) diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp index b02fa61..7f87b0d 100644 --- a/src/plugins/litehtml_viewer/lh_widget.cpp +++ b/src/plugins/litehtml_viewer/lh_widget.cpp @@ -121,6 +121,7 @@ lh_widget::~lh_widget() g_object_unref(m_scrolled_window); m_scrolled_window = NULL; m_html = NULL; + g_free(m_font_name); } GtkWidget *lh_widget::get_widget() const ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 23:50:25 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 23:50:25 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-164-g38ba9f7 Message-ID: <20190425215025.BC4F82100313@mx.colino.net> The branch, master has been updated via 38ba9f7dbab330968e841d3a44b0cfab9d02a5b8 (commit) from 969c422ede326adee17bf5009a0c55c687ef1f6f (commit) Summary of changes: src/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) - Log ----------------------------------------------------------------- commit 38ba9f7dbab330968e841d3a44b0cfab9d02a5b8 Author: Andrej Kacian Date: Thu Apr 25 23:49:47 2019 +0200 Fix a memory leak in sc_session_manager_connect() diff --git a/src/main.c b/src/main.c index 518ea75..87b2c56 100644 --- a/src/main.c +++ b/src/main.c @@ -641,6 +641,16 @@ static void sc_session_manager_connect(MainWindow *mainwin) NULL, &client_id, 256, error_string_ret); + /* From https://www.x.org/releases/X11R7.7/doc/libSM/SMlib.txt: + * If SmcOpenConnection succeeds, it returns an opaque connection + * pointer of type SmcConn and the client_id_ret argument contains + * the client ID to be used for this session. The client_id_ret + * should be freed with a call to free when no longer needed. On + * failure, SmcOpenConnection returns NULL, and the reason for + * failure is returned in error_string_ret. */ + if (mainwin->smc_conn != NULL) + g_free(client_id); + if (error_string_ret[0] || mainwin->smc_conn == NULL) g_warning ("While connecting to session manager: %s.", error_string_ret); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Thu Apr 25 23:59:55 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Thu, 25 Apr 2019 23:59:55 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-165-g82d9246 Message-ID: <20190425215955.A0B212100313@mx.colino.net> The branch, master has been updated via 82d9246acc83aa8e94e9d1585b38f7ee4cc8180d (commit) from 38ba9f7dbab330968e841d3a44b0cfab9d02a5b8 (commit) Summary of changes: src/imap.c | 98 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 53 insertions(+), 45 deletions(-) - Log ----------------------------------------------------------------- commit 82d9246acc83aa8e94e9d1585b38f7ee4cc8180d Author: Andrej Kacian Date: Thu Apr 25 23:59:40 2019 +0200 Fix memory leaks in imap_handle_error() diff --git a/src/imap.c b/src/imap.c index db6770a..8d8876b 100644 --- a/src/imap.c +++ b/src/imap.c @@ -600,9 +600,15 @@ static gboolean is_fatal(int libetpan_errcode) } } +#define MY_LOG_WARNING(concat_cmd, ...) \ + msg = concat_cmd; \ + log_warning(LOG_PROTOCOL, msg, __VA_ARGS__); \ + g_free(msg); + static void imap_handle_error(Session *session, const gchar *server, int libetpan_errcode) { const gchar *session_server = (session ? session->server : NULL); + gchar *msg; if (session_server == NULL) session_server = server; @@ -613,135 +619,135 @@ static void imap_handle_error(Session *session, const gchar *server, int libetpa case MAILIMAP_NO_ERROR: return; case MAILIMAP_NO_ERROR_AUTHENTICATED: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("authenticated"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("authenticated"), "\n", NULL), session_server) break; case MAILIMAP_NO_ERROR_NON_AUTHENTICATED: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("not authenticated"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("not authenticated"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_BAD_STATE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("bad state"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("bad state"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_STREAM: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("stream error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("stream error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_PARSE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("parse error " - "(very probably non-RFC compliance from the server)"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("parse error " + "(very probably non-RFC compliance from the server)"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_CONNECTION_REFUSED: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("connection refused"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("connection refused"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_MEMORY: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("memory error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("memory error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_FATAL: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("fatal error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("fatal error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_PROTOCOL: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("protocol error " - "(very probably non-RFC compliance from the server)"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("protocol error " + "(very probably non-RFC compliance from the server)"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_DONT_ACCEPT_CONNECTION: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("connection not accepted"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("connection not accepted"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_APPEND: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("APPEND error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("APPEND error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_NOOP: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("NOOP error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("NOOP error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_LOGOUT: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("LOGOUT error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("LOGOUT error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_CAPABILITY: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("CAPABILITY error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("CAPABILITY error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_CHECK: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("CHECK error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("CHECK error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_CLOSE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("CLOSE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("CLOSE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_EXPUNGE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("EXPUNGE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("EXPUNGE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_COPY: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("COPY error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("COPY error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_UID_COPY: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("UID COPY error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("UID COPY error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_CREATE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("CREATE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("CREATE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_DELETE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("DELETE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("DELETE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_EXAMINE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("EXAMINE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("EXAMINE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_FETCH: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("FETCH error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("FETCH error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_UID_FETCH: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("UID FETCH error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("UID FETCH error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_LIST: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("LIST error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("LIST error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_LOGIN: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("LOGIN error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("LOGIN error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_LSUB: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("LSUB error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("LSUB error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_RENAME: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("RENAME error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("RENAME error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_SEARCH: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("SEARCH error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("SEARCH error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_UID_SEARCH: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("UID SEARCH error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("UID SEARCH error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_SELECT: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("SELECT error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("SELECT error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_STATUS: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("STATUS error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("STATUS error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_STORE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("STORE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("STORE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_UID_STORE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("UID STORE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("UID STORE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_SUBSCRIBE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("SUBSCRIBE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("SUBSCRIBE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_UNSUBSCRIBE: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("UNSUBSCRIBE error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("UNSUBSCRIBE error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_STARTTLS: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("STARTTLS error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("STARTTLS error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_INVAL: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("INVAL error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("INVAL error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_EXTENSION: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("EXTENSION error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("EXTENSION error"), "\n", NULL), session_server) break; case MAILIMAP_ERROR_SASL: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("SASL error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("SASL error"), "\n", NULL), session_server) break; #ifdef USE_GNUTLS case MAILIMAP_ERROR_SSL: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("SSL/TLS error"), "\n", NULL), session_server); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("SSL/TLS error"), "\n", NULL), session_server) break; #endif default: - log_warning(LOG_PROTOCOL, g_strconcat(_("IMAP error on %s:"), " ", _("Unknown error [%d]"), "\n", NULL), - session_server, libetpan_errcode); + MY_LOG_WARNING(g_strconcat(_("IMAP error on %s:"), " ", _("Unknown error [%d]"), "\n", NULL), + session_server, libetpan_errcode) break; } @@ -753,6 +759,8 @@ static void imap_handle_error(Session *session, const gchar *server, int libetpa } } +#undef MY_LOG_WARNING + static Folder *imap_folder_new(const gchar *name, const gchar *path) { Folder *folder; ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Fri Apr 26 00:33:46 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Fri, 26 Apr 2019 00:33:46 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-166-g9bb6504 Message-ID: <20190425223346.DC3CF2100313@mx.colino.net> The branch, master has been updated via 9bb650480eaeb335c51b3127f78f0e71db309df6 (commit) from 82d9246acc83aa8e94e9d1585b38f7ee4cc8180d (commit) Summary of changes: src/common/session.c | 2 +- src/common/socket.c | 10 ++++++---- src/common/socket.h | 2 +- src/etpan/imap-thread.c | 18 ++++++++++++++---- src/etpan/nntp-thread.c | 18 ++++++++++++++---- src/plugins/notification/notification_lcdproc.c | 4 ++-- 6 files changed, 38 insertions(+), 16 deletions(-) - Log ----------------------------------------------------------------- commit 9bb650480eaeb335c51b3127f78f0e71db309df6 Author: Andrej Kacian Date: Fri Apr 26 00:28:58 2019 +0200 Free a memory leak in libetpan-backed server connections We create a connection using our sock_connect() and let libetpan take over managing it. However, libetpan only needs the socket file descriptor, so we need to get rid of the rest of the returned SockInfo struct. diff --git a/src/common/session.c b/src/common/session.c index a6f19ea..2da8e16 100644 --- a/src/common/session.c +++ b/src/common/session.c @@ -388,7 +388,7 @@ static gint session_close(Session *session) } if (session->sock) { - sock_close(session->sock); + sock_close(session->sock, TRUE); session->sock = NULL; session->state = SESSION_DISCONNECTED; debug_print("session (%p): closed\n", session); diff --git a/src/common/socket.c b/src/common/socket.c index fdc1589..c5814d7 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1486,7 +1486,7 @@ Single-byte send() and recv(). return bp - buf; } -gint sock_close(SockInfo *sock) +gint sock_close(SockInfo *sock, gboolean close_fd) { gint ret; @@ -1503,11 +1503,13 @@ gint sock_close(SockInfo *sock) g_source_remove(sock->g_source); sock->g_source = 0; #endif + if (close_fd) { #ifdef G_OS_WIN32 - shutdown(sock->sock, 1); /* complete transfer before close */ - ret = closesocket(sock->sock); + shutdown(sock->sock, 1); /* complete transfer before close */ + ret = closesocket(sock->sock); #else - ret = fd_close(sock->sock); + ret = fd_close(sock->sock); + } #endif g_free(sock->canonical_name); diff --git a/src/common/socket.h b/src/common/socket.h index 005f5a0..a1b17e5 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -108,7 +108,7 @@ gint sock_connect_async_cancel (gint id); gint sock_read (SockInfo *sock, gchar *buf, gint len); gint sock_write (SockInfo *sock, const gchar *buf, gint len); gint sock_write_all (SockInfo *sock, const gchar *buf, gint len); -gint sock_close (SockInfo *sock); +gint sock_close (SockInfo *sock, gboolean close_fd); /* Functions to directly work on FD. They are needed for pipes */ gint fd_connect_unix (const gchar *path); diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c index b68e303..eeccac7 100644 --- a/src/etpan/imap-thread.c +++ b/src/etpan/imap-thread.c @@ -78,17 +78,22 @@ static int do_mailimap_socket_connect(mailimap * imap, const char * server, return MAILIMAP_ERROR_CONNECTION_REFUSED; if (proxy_connect(sock, server, port, proxy_info) < 0) { - sock_close(sock); + sock_close(sock, TRUE); return MAILIMAP_ERROR_CONNECTION_REFUSED; } stream = mailstream_socket_open_timeout(sock->sock, imap->imap_timeout); if (stream == NULL) { - sock_close(sock); + sock_close(sock, TRUE); return MAILIMAP_ERROR_MEMORY; } + /* Libetpan now has the socket fd, and we're not interested in + * rest of the SockInfo struct. Let's free it, while not touching + * the socket itself. */ + sock_close(sock, FALSE); + return mailimap_connect(imap, stream); } @@ -119,17 +124,22 @@ static int do_mailimap_ssl_connect_with_callback(mailimap * imap, const char * s if (proxy_connect(sock, server, port, proxy_info) < 0) { debug_print("Can not make proxy connection via %s:%d\n", proxy_info->proxy_host, proxy_info->proxy_port); - sock_close(sock); + sock_close(sock, TRUE); return MAILIMAP_ERROR_CONNECTION_REFUSED; } stream = mailstream_ssl_open_with_callback_timeout(sock->sock, imap->imap_timeout, callback, data); if (stream == NULL) { - sock_close(sock); + sock_close(sock, TRUE); return MAILIMAP_ERROR_SSL; } + /* Libetpan now has the socket fd, and we're not interested in + * rest of the SockInfo struct. Let's free it, while not touching + * the socket itself. */ + sock_close(sock, FALSE); + return mailimap_connect(imap, stream); } diff --git a/src/etpan/nntp-thread.c b/src/etpan/nntp-thread.c index bf67cd0..5f5b31b 100644 --- a/src/etpan/nntp-thread.c +++ b/src/etpan/nntp-thread.c @@ -78,17 +78,22 @@ static int do_newsnntp_socket_connect(newsnntp * imap, const char * server, return NEWSNNTP_ERROR_CONNECTION_REFUSED; if (proxy_connect(sock, server, port, proxy_info) < 0) { - sock_close(sock); + sock_close(sock, TRUE); return NEWSNNTP_ERROR_CONNECTION_REFUSED; } stream = mailstream_socket_open_timeout(sock->sock, imap->nntp_timeout); if (stream == NULL) { - sock_close(sock); + sock_close(sock, TRUE); return NEWSNNTP_ERROR_MEMORY; } + /* Libetpan now has the socket fd, and we're not interested in + * rest of the SockInfo struct. Let's free it, while not touching + * the socket itself. */ + sock_close(sock, FALSE); + return newsnntp_connect(imap, stream); } @@ -114,17 +119,22 @@ static int do_newsnntp_ssl_connect_with_callback(newsnntp * imap, const char * s return NEWSNNTP_ERROR_CONNECTION_REFUSED; if (proxy_connect(sock, server, port, proxy_info) < 0) { - sock_close(sock); + sock_close(sock, TRUE); return NEWSNNTP_ERROR_CONNECTION_REFUSED; } stream = mailstream_ssl_open_with_callback_timeout(sock->sock, imap->nntp_timeout, callback, data); if (stream == NULL) { - sock_close(sock); + sock_close(sock, TRUE); return NEWSNNTP_ERROR_SSL; } + /* Libetpan now has the socket fd, and we're not interested in + * rest of the SockInfo struct. Let's free it, while not touching + * the socket itself. */ + sock_close(sock, FALSE); + return newsnntp_connect(imap, stream); } diff --git a/src/plugins/notification/notification_lcdproc.c b/src/plugins/notification/notification_lcdproc.c index 874caa7..0f131d1 100644 --- a/src/plugins/notification/notification_lcdproc.c +++ b/src/plugins/notification/notification_lcdproc.c @@ -61,7 +61,7 @@ void notification_lcdproc_connect(void) if(sock == NULL || sock->state == CONN_FAILED) { debug_print("Could not connect to LCDd\n"); if(sock && sock->state == CONN_FAILED) { - sock_close(sock); + sock_close(sock, TRUE); sock = NULL; } return; @@ -116,7 +116,7 @@ void notification_lcdproc_disconnect(void) #ifndef G_OS_WIN32 shutdown(sock->sock, SHUT_RDWR); #endif - sock_close(sock); + sock_close(sock, TRUE); sock = NULL; } } ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Fri Apr 26 08:16:51 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Fri, 26 Apr 2019 08:16:51 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-167-gfe278b3 Message-ID: <20190426061652.162192100313@mx.colino.net> The branch, master has been updated via fe278b3cc9209a1b34024658467f4dd6e467b97a (commit) from 9bb650480eaeb335c51b3127f78f0e71db309df6 (commit) Summary of changes: src/common/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit fe278b3cc9209a1b34024658467f4dd6e467b97a Author: Andrej Kacian Date: Fri Apr 26 08:16:08 2019 +0200 Fix a syntax error in sock_close() causing windows build to fail diff --git a/src/common/socket.c b/src/common/socket.c index c5814d7..ad740b5 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1509,8 +1509,8 @@ gint sock_close(SockInfo *sock, gboolean close_fd) ret = closesocket(sock->sock); #else ret = fd_close(sock->sock); - } #endif + } g_free(sock->canonical_name); g_free(sock->hostname); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Sun Apr 28 23:15:34 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Sun, 28 Apr 2019 23:15:34 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-168-ged39558 Message-ID: <20190428211534.451772100313@mx.colino.net> The branch, master has been updated via ed39558ac116e480cdbe18a6ee6c5602150994cb (commit) from fe278b3cc9209a1b34024658467f4dd6e467b97a (commit) Summary of changes: src/plugins/rssyl/parse822.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) - Log ----------------------------------------------------------------- commit ed39558ac116e480cdbe18a6ee6c5602150994cb Author: Andrej Kacian Date: Sun Apr 28 23:13:32 2019 +0200 Simplify item body parsing in rssyl_parse_folder_item_file() This possibly fixes a memory corruption issue, too. diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c index 4732afa..0553de6 100644 --- a/src/plugins/rssyl/parse822.c +++ b/src/plugins/rssyl/parse822.c @@ -55,6 +55,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) FeedItem *item; RFeedCtx *ctx; gint i = 0; + GString *body = NULL; gboolean parsing_headers = TRUE, past_html_tag = FALSE, past_endhtml_tag = FALSE; gboolean started_author = FALSE, started_subject = FALSE; gboolean started_link = FALSE, started_clink = FALSE, got_original_title = FALSE; @@ -207,26 +208,29 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) i++; continue; } - if( feed_item_get_text(item) != NULL ) { - gint e_len, n_len; - e_len = strlen(item->text); - n_len = strlen(lines[i]); - item->text = g_realloc(item->text, e_len + n_len + 2); - *(item->text+e_len) = '\n'; - strcpy(item->text+e_len+1, lines[i]); - *(item->text+e_len+n_len+1) = '\0'; + + if (body) { + debug_print("appending '%s'\n", lines[i]); + body = g_string_append(body, lines[i]); } else { - item->text = g_strdup(lines[i]); + debug_print("creating new with '%s'\n", lines[i]); + body = g_string_new(lines[i]); } + i++; } - if( lines[i] == NULL ) - return item; } i++; } + + if (body != NULL ) { + if (past_endhtml_tag && body->str != NULL && body->len > 0) + feed_item_set_text(item, body->str); + g_string_free(body, TRUE); + } + g_free(lines); g_free(contents); return item; ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Sun Apr 28 23:22:32 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Sun, 28 Apr 2019 23:22:32 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-169-g24c3e4c Message-ID: <20190428212232.CE7922100314@mx.colino.net> The branch, master has been updated via 24c3e4c3f5d8af1139dc0dac55eee907dd0a72c6 (commit) from ed39558ac116e480cdbe18a6ee6c5602150994cb (commit) Summary of changes: src/plugins/rssyl/parse822.c | 3 --- 1 file changed, 3 deletions(-) - Log ----------------------------------------------------------------- commit 24c3e4c3f5d8af1139dc0dac55eee907dd0a72c6 Author: Andrej Kacian Date: Sun Apr 28 23:22:00 2019 +0200 Remove unnecessary debug output from previous commit diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c index 0553de6..e59d282 100644 --- a/src/plugins/rssyl/parse822.c +++ b/src/plugins/rssyl/parse822.c @@ -205,15 +205,12 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) if( !strcmp(lines[i], RSSYL_TEXT_END) ) { debug_print("RSSyl: Trailing html tag found at line %d\n", i); past_endhtml_tag = TRUE; - i++; continue; } if (body) { - debug_print("appending '%s'\n", lines[i]); body = g_string_append(body, lines[i]); } else { - debug_print("creating new with '%s'\n", lines[i]); body = g_string_new(lines[i]); } ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Mon Apr 29 01:07:15 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Mon, 29 Apr 2019 01:07:15 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-170-g6787210 Message-ID: <20190428230715.A23D42100313@mx.colino.net> The branch, master has been updated via 6787210ce7906afcc93460c7e63c788872fa37a4 (commit) from 24c3e4c3f5d8af1139dc0dac55eee907dd0a72c6 (commit) Summary of changes: src/plugins/rssyl/parse822.c | 1 + 1 file changed, 1 insertion(+) - Log ----------------------------------------------------------------- commit 6787210ce7906afcc93460c7e63c788872fa37a4 Author: Andrej Kacian Date: Mon Apr 29 01:06:07 2019 +0200 Fix previous commit The old code added a newline before each line in rssyl_parse_folder_item_file(). diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c index e59d282..1c89c77 100644 --- a/src/plugins/rssyl/parse822.c +++ b/src/plugins/rssyl/parse822.c @@ -209,6 +209,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) } if (body) { + body = g_string_append_c(body, '\n'); body = g_string_append(body, lines[i]); } else { body = g_string_new(lines[i]); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Tue Apr 30 23:02:56 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Tue, 30 Apr 2019 23:02:56 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-171-gd405b9c Message-ID: <20190430210257.17E0A2100313@mx.colino.net> The branch, master has been updated via d405b9c5472922f089c200eae12d27911950f358 (commit) from 6787210ce7906afcc93460c7e63c788872fa37a4 (commit) Summary of changes: src/plugins/rssyl/parse822.c | 10 ++++------ src/plugins/rssyl/rssyl_add_item.c | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) - Log ----------------------------------------------------------------- commit d405b9c5472922f089c200eae12d27911950f358 Author: Andrej Kacian Date: Tue Apr 30 23:02:18 2019 +0200 Fix parsing items with empty bodies from on-disk RSSyl items diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c index 1c89c77..51cb313 100644 --- a/src/plugins/rssyl/parse822.c +++ b/src/plugins/rssyl/parse822.c @@ -198,6 +198,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) if( !strcmp(lines[i], RSSYL_TEXT_START) ) { debug_print("RSSyl: Leading html tag found at line %d\n", i); past_html_tag = TRUE; + body = g_string_new(""); i++; continue; } @@ -208,12 +209,9 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) continue; } - if (body) { + if (body->len > 0) body = g_string_append_c(body, '\n'); - body = g_string_append(body, lines[i]); - } else { - body = g_string_new(lines[i]); - } + body = g_string_append(body, lines[i]); i++; } @@ -224,7 +222,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path) } if (body != NULL ) { - if (past_endhtml_tag && body->str != NULL && body->len > 0) + if (past_html_tag && past_endhtml_tag && body->str != NULL) feed_item_set_text(item, body->str); g_string_free(body, TRUE); } diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c index d22e1dd..c40c9cd 100644 --- a/src/plugins/rssyl/rssyl_add_item.c +++ b/src/plugins/rssyl/rssyl_add_item.c @@ -542,7 +542,8 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item) (heading ? heading : ""), (tmpurl ? tmpurl : ""), (tmpurl ? tmpurl : "n/a"), - (text ? text : ""), (text ? "\n" : "") ); + (text ? text : ""), + (text && strlen(text) > 0 ? "\n" : "") ); g_free(meta_charset); g_free(baseurl); ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail From ticho at claws-mail.org Tue Apr 30 23:03:46 2019 From: ticho at claws-mail.org (ticho at claws-mail.org) Date: Tue, 30 Apr 2019 23:03:46 +0200 (CEST) Subject: [Commits] [SCM] claws branch, master, updated. 3.17.3-172-g7d4d219 Message-ID: <20190430210346.9A8872100313@mx.colino.net> The branch, master has been updated via 7d4d2199593a85aefee2fb3d9a6645451c35196a (commit) from d405b9c5472922f089c200eae12d27911950f358 (commit) Summary of changes: src/plugins/rssyl/libfeed/feeditem.c | 2 +- src/plugins/rssyl/libfeed/feeditemenclosure.c | 9 +++++++++ src/plugins/rssyl/libfeed/feeditemenclosure.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) - Log ----------------------------------------------------------------- commit 7d4d2199593a85aefee2fb3d9a6645451c35196a Author: Andrej Kacian Date: Tue Apr 30 23:03:03 2019 +0200 Fix a memory corruption bug in RSSyl's feed_item_copy() diff --git a/src/plugins/rssyl/libfeed/feeditem.c b/src/plugins/rssyl/libfeed/feeditem.c index 340cbf5..8d9faaa 100644 --- a/src/plugins/rssyl/libfeed/feeditem.c +++ b/src/plugins/rssyl/libfeed/feeditem.c @@ -344,7 +344,7 @@ FeedItem *feed_item_copy(FeedItem *item) nitem->comments_url = g_strdup(item->comments_url); nitem->parent_id = g_strdup(item->parent_id); - nitem->enclosure = g_memdup(item->enclosure, sizeof(FeedItemEnclosure)); + nitem->enclosure = feed_item_enclosure_copy(item->enclosure); nitem->date_published = item->date_published; nitem->date_modified = item->date_modified; diff --git a/src/plugins/rssyl/libfeed/feeditemenclosure.c b/src/plugins/rssyl/libfeed/feeditemenclosure.c index 183cfb5..7f55961 100644 --- a/src/plugins/rssyl/libfeed/feeditemenclosure.c +++ b/src/plugins/rssyl/libfeed/feeditemenclosure.c @@ -98,3 +98,12 @@ void feed_item_enclosure_set_size(FeedItemEnclosure *enclosure, gulong size) enclosure->size = size; } + +FeedItemEnclosure *feed_item_enclosure_copy(FeedItemEnclosure *enclosure) +{ + if (enclosure == NULL) + return NULL; + + return feed_item_enclosure_new(enclosure->url, enclosure->type, + enclosure->size); +} diff --git a/src/plugins/rssyl/libfeed/feeditemenclosure.h b/src/plugins/rssyl/libfeed/feeditemenclosure.h index ba4d127..69e9eff 100644 --- a/src/plugins/rssyl/libfeed/feeditemenclosure.h +++ b/src/plugins/rssyl/libfeed/feeditemenclosure.h @@ -40,4 +40,6 @@ void feed_item_enclosure_set_type(FeedItemEnclosure *enclosure, gchar *type); gulong feed_item_enclosure_get_size(FeedItemEnclosure *enclosure); void feed_item_enclosure_set_size(FeedItemEnclosure *enclosure, gulong size); +FeedItemEnclosure *feed_item_enclosure_copy(FeedItemEnclosure *enclosure); + #endif /* __FEEDITEMENCLOSURE_H */ ----------------------------------------------------------------------- hooks/post-receive -- Claws Mail