1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

[Combi] Fix possible memory leak.

This commit is contained in:
Dave Davenport 2022-08-21 02:57:16 +02:00
parent bd60a68d1c
commit d5cd4ca32d

View file

@ -166,11 +166,18 @@ static ModeMode combi_mode_result(Mode *sw, int mretv, char **input,
}
}
if (switcher >= 0) {
if (eob[0] == ' ' || eob[0] == '\0') {
printf("found mode\n");
char *n = eob + 1;
return mode_result(pd->switchers[switcher].mode, mretv, &n,
selected_line - pd->starts[switcher]);
if (eob[0] == ' ') {
char *n = g_strdup(eob + 1);
ModeMode retv = mode_result(pd->switchers[switcher].mode, mretv, &n,
selected_line - pd->starts[switcher]);
g_free(n);
return retv;
} else if (eob[0] == '\0') {
char *str = NULL;
ModeMode retv = mode_result(pd->switchers[switcher].mode, mretv, &str,
selected_line - pd->starts[switcher]);
g_free(str);
return retv;
}
return MODE_EXIT;
}