mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03: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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user