mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virSecretLoadAllConfigs: Use g_autofree for @path
When loading virSecret configs, the @path variable holds path to individual config files. In each iteration it is freed explicitly using VIR_FREE(). Switch it to g_autofree and remove those explicit calls. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
28602827e9
commit
7cb31974ec
@ -902,7 +902,7 @@ virSecretLoadAllConfigs(virSecretObjList *secrets,
|
|||||||
/* Ignore errors reported by readdir or other calls within the
|
/* Ignore errors reported by readdir or other calls within the
|
||||||
* loop (if any). It's better to keep the secrets we managed to find. */
|
* loop (if any). It's better to keep the secrets we managed to find. */
|
||||||
while (virDirRead(dir, &de, NULL) > 0) {
|
while (virDirRead(dir, &de, NULL) > 0) {
|
||||||
char *path;
|
g_autofree char *path = NULL;
|
||||||
virSecretObj *obj;
|
virSecretObj *obj;
|
||||||
|
|
||||||
if (!virStringHasSuffix(de->d_name, ".xml"))
|
if (!virStringHasSuffix(de->d_name, ".xml"))
|
||||||
@ -914,11 +914,9 @@ virSecretLoadAllConfigs(virSecretObjList *secrets,
|
|||||||
if (!(obj = virSecretLoad(secrets, de->d_name, path, configDir))) {
|
if (!(obj = virSecretLoad(secrets, de->d_name, path, configDir))) {
|
||||||
VIR_ERROR(_("Error reading secret: %1$s"),
|
VIR_ERROR(_("Error reading secret: %1$s"),
|
||||||
virGetLastErrorMessage());
|
virGetLastErrorMessage());
|
||||||
VIR_FREE(path);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(path);
|
|
||||||
virSecretObjEndAPI(&obj);
|
virSecretObjEndAPI(&obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user