This saves us explicit call of g_strfreev() in error path.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/vsh.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index cc777bee12..3cb657f582 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2778,9 +2778,9 @@ vshReadlineParse(const char *text, int state)
list = vshReadlineOptionsGenerator(text, cmd, partial);
if (opt && opt->completer) {
- char **completer_list = opt->completer(autoCompleteOpaque,
- partial,
- opt->completer_flags);
+ g_auto(GStrv) completer_list = opt->completer(autoCompleteOpaque,
+ partial,
+ opt->completer_flags);
/* Escape completions, if needed (i.e. argument
* we are completing wasn't started with a quote
@@ -2805,7 +2805,6 @@ vshReadlineParse(const char *text, int state)
if (completer_list &&
(vshCompleterFilter(&completer_list, text) < 0 ||
virStringListMerge(&list, &completer_list) < 0)) {
- g_strfreev(completer_list);
goto cleanup;
}
}
--
2.26.2