Check for NULLs params within the functions
authorRicardo Mones <ricardo@mones.org>
Sun, 23 Jul 2017 10:38:06 +0000 (12:38 +0200)
committerRicardo Mones <ricardo@mones.org>
Sun, 23 Jul 2017 10:38:06 +0000 (12:38 +0200)
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]

src/prefs_themes.c
src/stock_pixmap.c

index 10f6baf..7472c53 100644 (file)
@@ -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);
index 5a95706..807d862 100644 (file)
@@ -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);