talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit fb5fce43ffcf73d9bd08734b7a84acf0ea8f12a9
parent a93dbd4a83b53c01b8485d10634f40cc1642a9c1
Author: Ricardo Mones <ricardo@mones.org>
Date:   Sun, 23 Jul 2017 12:38:06 +0200

Check for NULLs params within the functions

As assumed in the prefs_themes_done() calls. May fix some strange crash
when exiting Claws Mail in Debian's version 3.14.1-3+b1:

*** Error in `/usr/bin/claws-mail': munmap_chunk(): invalid pointer:
0x00000000026a6f80 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7fa85407cbcb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76f96)[0x7fa854082f96]
/usr/bin/claws-mail(stock_pixmap_themes_list_free+0x28)[0x55a7a8]
/usr/bin/claws-mail(prefs_themes_done+0x3a)[0x5389ba]
/usr/bin/claws-mail[0x449329]
/usr/bin/claws-mail(main+0x2326)[0x44b986]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7fa85402c2b1]
/usr/bin/claws-mail(_start+0x2a)[0x44bfda]

Diffstat:
Msrc/prefs_themes.c | 9+++++----
Msrc/stock_pixmap.c | 2++
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/prefs_themes.c b/src/prefs_themes.c @@ -352,10 +352,8 @@ static void prefs_themes_get_themes_and_names(ThemesData *tdata) cm_return_if_fail(tdata != NULL); - if (tdata->themes != NULL) - stock_pixmap_themes_list_free(tdata->themes); - if (tdata->names != NULL) - prefs_themes_free_names(tdata); + stock_pixmap_themes_list_free(tdata->themes); + prefs_themes_free_names(tdata); tdata->themes = stock_pixmap_themes_list_new(); @@ -421,6 +419,9 @@ static void prefs_themes_free_names(ThemesData *tdata) { GList *names; + cm_return_if_fail(tdata != NULL); + cm_return_if_fail(tdata->names != NULL); + names = tdata->names; while (names != NULL) { ThemeName *tn = (ThemeName *)(names->data); diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c @@ -840,6 +840,8 @@ void stock_pixmap_themes_list_free(GList *list) { GList *ptr; + cm_return_if_fail(list != NULL); + for (ptr = g_list_first(list); ptr != NULL; ptr = g_list_next(ptr)) g_free(ptr->data); g_list_free(list);