mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
vsh: Use g_auto(GStrv) to free string list returned by completer callback
This saves us explicit call of g_strfreev() in error path. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
58aeebe096
commit
268f16293c
@ -2778,9 +2778,9 @@ vshReadlineParse(const char *text, int state)
|
|||||||
list = vshReadlineOptionsGenerator(text, cmd, partial);
|
list = vshReadlineOptionsGenerator(text, cmd, partial);
|
||||||
|
|
||||||
if (opt && opt->completer) {
|
if (opt && opt->completer) {
|
||||||
char **completer_list = opt->completer(autoCompleteOpaque,
|
g_auto(GStrv) completer_list = opt->completer(autoCompleteOpaque,
|
||||||
partial,
|
partial,
|
||||||
opt->completer_flags);
|
opt->completer_flags);
|
||||||
|
|
||||||
/* Escape completions, if needed (i.e. argument
|
/* Escape completions, if needed (i.e. argument
|
||||||
* we are completing wasn't started with a quote
|
* we are completing wasn't started with a quote
|
||||||
@ -2805,7 +2805,6 @@ vshReadlineParse(const char *text, int state)
|
|||||||
if (completer_list &&
|
if (completer_list &&
|
||||||
(vshCompleterFilter(&completer_list, text) < 0 ||
|
(vshCompleterFilter(&completer_list, text) < 0 ||
|
||||||
virStringListMerge(&list, &completer_list) < 0)) {
|
virStringListMerge(&list, &completer_list) < 0)) {
|
||||||
g_strfreev(completer_list);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user