diff --git a/lib/acpi.c b/lib/acpi.c index 2bb50eb..9ea746c 100644 --- a/lib/acpi.c +++ b/lib/acpi.c @@ -631,6 +631,7 @@ get_acpi_info (void) TRACE ("leaves get_acpi_info"); version = get_acpi_value (filename); + g_free (filename); if (version!=NULL) version = g_strchomp (version); @@ -654,6 +655,7 @@ get_acpi_zone_value (char *zone, char *file) filename = g_strdup_printf ("%s/%s/%s", ACPI_PATH, zone, file); value = get_acpi_value (filename); + g_free(filename); TRACE ("leaves get_acpi_zone_value with correctly converted value"); diff --git a/lib/hddtemp.c b/lib/hddtemp.c index 5089f34..7d0277b 100644 --- a/lib/hddtemp.c +++ b/lib/hddtemp.c @@ -194,7 +194,7 @@ void quick_message (gchar *message) void read_disks_netcat (t_chip *chip) { - char *stdoutput, *stderrput, *cmdline, *tmp, *tmp2, *tmp3; + gchar *stdoutput = NULL, *stderrput = NULL, *cmdline, *tmp, *tmp2, *tmp3; gboolean result; gint exit_status = 0; GError *error = NULL; @@ -207,9 +207,15 @@ read_disks_netcat (t_chip *chip) result = g_spawn_command_line_sync ( (const gchar*) cmdline, &stdoutput, &stderrput, &exit_status, &error); - if (!result) + g_free (cmdline); + + if (!result) { + g_error_free(error); return; + } + g_free (stderrput); + //g_printf("stdouput=%s\n", stdoutput); tmp = str_split (stdoutput, DOUBLE_DELIMITER); @@ -487,7 +493,7 @@ get_hddtemp_value (char* disk, gboolean *suppressmessage) tmp3 = strdup(strtok(NULL, SINGLE_DELIMITER)); // value // tmp3 = strtok(NULL, SINGLE_DELIMITER); // temperature unit exit_status = 0; - g_free(error); + g_error_free(error); error = NULL; g_free (tmp2); break; @@ -604,6 +610,8 @@ get_hddtemp_value (char* disk, gboolean *suppressmessage) g_free (checktext); #endif + if (error) g_error_free(error); + TRACE ("leaves get_hddtemp_value"); return value; diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c index fccefed..519d0f4 100644 --- a/panel-plugin/sensors-plugin.c +++ b/panel-plugin/sensors-plugin.c @@ -627,7 +627,9 @@ sensors_set_text_panel_label (t_sensors *sensors, gint numCols, gint itemsToDisp if (chipfeature->show == TRUE) { if(sensors->show_labels==TRUE) { - myLabelText = g_strconcat (myLabelText, "font_size, "\">",chipfeature->name, ": ", NULL); + tmpstring = g_strconcat (myLabelText, "font_size, "\">",chipfeature->name, ": ", NULL); + g_free(myLabelText); + myLabelText = tmpstring; } if (sensors->show_units) { @@ -650,18 +652,29 @@ sensors_set_text_panel_label (t_sensors *sensors, gint numCols, gint itemsToDisp myLabelText = tmpstring; if (sensors->orientation == GTK_ORIENTATION_VERTICAL) { - if (itemsToDisplay > 1) - myLabelText = g_strconcat (myLabelText, "\n", NULL); + if (itemsToDisplay > 1) { + tmpstring = g_strconcat (myLabelText, "\n", NULL); + g_free(myLabelText); + myLabelText = tmpstring; + } } else if (currentColumn < numCols-1) { - if (sensors->show_smallspacings) - myLabelText = g_strconcat (myLabelText, " ", NULL); - else - myLabelText = g_strconcat (myLabelText, " \t", NULL); + if (sensors->show_smallspacings) { + tmpstring = g_strconcat (myLabelText, " ", NULL); + g_free(myLabelText); + myLabelText = tmpstring; + } + else { + tmpstring = g_strconcat (myLabelText, " \t", NULL); + g_free(myLabelText); + myLabelText = tmpstring; + } currentColumn++; } else if (itemsToDisplay > 1) { /* do NOT add \n if last item */ - myLabelText = g_strconcat (myLabelText, " \n", NULL); + tmpstring = g_strconcat (myLabelText, " \n", NULL); + g_free(myLabelText); + myLabelText = tmpstring; currentColumn = 0; } itemsToDisplay--; @@ -790,6 +803,7 @@ sensors_create_tooltip (gpointer data) if (prependedChipName != TRUE) { if (first == TRUE) { + g_free (myToolTipText); myToolTipText = g_strdup (chip->sensorId); first = FALSE; }