summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@blame.services>2022-08-21 02:57:16 +0200
committerDave Davenport <qball@blame.services>2022-08-21 02:57:16 +0200
commitd5cd4ca32d8b7b185acdc7a2db636009c83e9240 (patch)
treede581f3ab5ca98912d444621da200a0805ee4e70
parentbd60a68d1c3f9b57481da6ff4de846513dd5f2f8 (diff)
[Combi] Fix possible memory leak.
-rw-r--r--source/modes/combi.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/modes/combi.c b/source/modes/combi.c
index 7297a12e..9e548906 100644
--- a/source/modes/combi.c
+++ b/source/modes/combi.c
@@ -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;
}