! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Segfault on removal from panel
Status:
RESOLVED: FIXED
Product:
Xfce4-sensors-plugin
Component:
General

Comments

Description Lionel Le Folgoc 2012-04-20 15:12:42 CEST
Created attachment 4349 
possible patch

Hi,

Xfce4-sensors-plugin crashes when I try to remove it from the panel here, with a trace top similar to:
 __GI___libc_free (mem=0x7fb5ff738704) at malloc.c:2982
 sensors_free (plugin=<optimized out>, sensors=0x7fb600a17390) at sensors-plugin.c:1091

Looking at the code, sensors->font_size is sometimes used to hold strdup'd strings, and sometimes static strings. So it won't go well when it tries to free it in sensors_free().

lib/sensors-interface-common.c:    sensors->font_size = "medium";
lib/configuration.c:            sensors->font_size = g_strdup(value);
panel-plugin/sensors-plugin.c:    g_free (sensors->font_size);
panel-plugin/sensors-plugin.c:        case 0: sd->sensors->font_size = "x-small"; break;
panel-plugin/sensors-plugin.c:        case 1: sd->sensors->font_size = "small"; break;
panel-plugin/sensors-plugin.c:        case 3: sd->sensors->font_size = "large"; break;
panel-plugin/sensors-plugin.c:        case 4: sd->sensors->font_size = "x-large"; break;
panel-plugin/sensors-plugin.c:        default: sd->sensors->font_size = "medium";

So g_free is only correct when the font size is read from the config file. The rest of the time it will make the plugin crash. Duping these static strings should fix that.
Thanks!
Comment 1 Fabian Nowak editbugs 2012-04-24 10:11:01 CEST
gee, that kind of fault really hasn'T been removed entirely? Sorry for the inconvenience, shouldn't have been any longer in the code due to previous similar errors. Will fix that soon.
Comment 2 Fabian Nowak editbugs 2012-05-13 15:29:02 CEST
applied, though you missed at least one more location where the same missing free() is supposed to be for another variable ;)
Comment 3 Fabian Nowak editbugs 2012-05-13 16:58:01 CEST
*** Bug 6567 has been marked as a duplicate of this bug. ***

Bug #8745

Reported by:
Lionel Le Folgoc
Reported on: 2012-04-20
Last modified on: 2012-05-13
Duplicates (1):
  • 6567 xfce4-sensors-plugin crashed with SIGSEGV in memalign()

People

Assignee:
Fabian Nowak
CC List:
1 user

Version

Version:
unspecified

Attachments

possible patch (1.88 KB, patch)
2012-04-20 15:12 CEST , Lionel Le Folgoc
no flags

Additional information