mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
lib: Use g_clear_pointer() more
This change was generated using the following spatch:
@ rule1 @
expression a;
identifier f;
@@
<...
- f(*a);
... when != a;
- *a = NULL;
+ g_clear_pointer(a, f);
...>
@ rule2 @
expression a;
identifier f;
@@
<...
- f(a);
... when != a;
- a = NULL;
+ g_clear_pointer(&a, f);
...>
Then, I left some of the changes out, like tools/nss/ (which
doesn't link with glib) and put back a comment in
qemuBlockJobProcessEventCompletedActiveCommit() which coccinelle
decided to remove (I have no idea why).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -1740,8 +1740,7 @@ virshDomainListCollect(vshControl *ctl, unsigned int flags)
|
||||
|
||||
remove_entry:
|
||||
/* the domain has to be removed as it failed one of the filters */
|
||||
virshDomainFree(list->domains[i]);
|
||||
list->domains[i] = NULL;
|
||||
g_clear_pointer(&list->domains[i], virshDomainFree);
|
||||
deleted++;
|
||||
}
|
||||
|
||||
@@ -1762,8 +1761,7 @@ virshDomainListCollect(vshControl *ctl, unsigned int flags)
|
||||
VIR_FREE(names[i]);
|
||||
|
||||
if (!success) {
|
||||
virshDomainListFree(list);
|
||||
list = NULL;
|
||||
g_clear_pointer(&list, virshDomainListFree);
|
||||
}
|
||||
|
||||
VIR_FREE(names);
|
||||
|
||||
Reference in New Issue
Block a user