fbd-dev-leds: Don't leak enum_name
g_enum_to_string() is transfer full.
This commit is contained in:
committed by
Guido Gunther
parent
d7419f37a1
commit
d8f944ed30
+4
-2
@@ -117,10 +117,12 @@ initable_init (GInitable *initable,
|
|||||||
color LEDSs so go with fixed colors until the kernel gives us
|
color LEDSs so go with fixed colors until the kernel gives us
|
||||||
enough information */
|
enough information */
|
||||||
for (int i = 0; i <= FBD_FEEDBACK_LED_COLOR_LAST; i++) {
|
for (int i = 0; i <= FBD_FEEDBACK_LED_COLOR_LAST; i++) {
|
||||||
g_autofree gchar *color;
|
g_autofree char *color = NULL;
|
||||||
|
g_autofree char *enum_name = NULL;
|
||||||
gchar *c;
|
gchar *c;
|
||||||
|
|
||||||
c = strrchr (g_enum_to_string (FBD_TYPE_FEEDBACK_LED_COLOR, i), '_');
|
enum_name = g_enum_to_string (FBD_TYPE_FEEDBACK_LED_COLOR, i);
|
||||||
|
c = strrchr (enum_name, '_');
|
||||||
color = g_strdup (g_ascii_strdown (c+1, -1));
|
color = g_strdup (g_ascii_strdown (c+1, -1));
|
||||||
if (g_strstr_len (name, -1, color)) {
|
if (g_strstr_len (name, -1, color)) {
|
||||||
g_autoptr (GError) err = NULL;
|
g_autoptr (GError) err = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user