Here's a quick patch for an unnecessary string duplication I found in battery.c: --- panel-plugin/battery.c +++ panel-plugin/battery.c @@ -296,8 +296,7 @@ } if (acline && new_state != BM_MISSING) { - gchar *tmp = g_strdup(icon_name); - g_free(icon_name); + gchar *tmp = icon_name; new_state++; icon_name = g_strconcat(tmp, "-charging", NULL); g_free(tmp); I found this because I noticed a memory leak in this code, which has already been fixed in the following commit: https://git.xfce.org/panel-plugins/xfce4-battery-plugin/commit/panel-plugin/battery.c?id=b32c015ed36c0f6e9e053351482303a15615847a It's not necessary to duplicate the original string. One only needs a copy of the pointer to it, so that it can be freed after its pointer is adjusted.
Andre Miranda referenced this bugreport in commit 695d02fd13a5394b81d02262dd1edb887034a0d6 Avoid unnecessary strdup (Bug #15196) https://git.xfce.org/panel-plugins/xfce4-battery-plugin/commit?id=695d02fd13a5394b81d02262dd1edb887034a0d6
I just introduced the missing g_free but didn't notice the strdup was unnecessary, good catch! Thank you.