mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
virDomainDriverGetIOThreadsConfig: Automatically free virBitmap
Use g_autoptr for the temp bitmap. To achieve this the variable must be moved down to the appropriate scope. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
33d6d05754
commit
5cbdea694d
@ -592,8 +592,6 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetDef,
|
||||
unsigned int bitmap_size)
|
||||
{
|
||||
virDomainIOThreadInfoPtr *info_ret = NULL;
|
||||
virBitmap *bitmap = NULL;
|
||||
virBitmap *cpumask = NULL;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
@ -603,6 +601,8 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetDef,
|
||||
info_ret = g_new0(virDomainIOThreadInfoPtr, targetDef->niothreadids);
|
||||
|
||||
for (i = 0; i < targetDef->niothreadids; i++) {
|
||||
g_autoptr(virBitmap) bitmap = NULL;
|
||||
virBitmap *cpumask = NULL;
|
||||
info_ret[i] = g_new0(virDomainIOThreadInfo, 1);
|
||||
|
||||
/* IOThread ID's are taken from the iothreadids list */
|
||||
@ -627,8 +627,6 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetDef,
|
||||
if (virBitmapToData(cpumask, &info_ret[i]->cpumap,
|
||||
&info_ret[i]->cpumaplen) < 0)
|
||||
goto cleanup;
|
||||
virBitmapFree(bitmap);
|
||||
bitmap = NULL;
|
||||
}
|
||||
|
||||
*info = g_steal_pointer(&info_ret);
|
||||
@ -640,7 +638,6 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetDef,
|
||||
virDomainIOThreadInfoFree(info_ret[i]);
|
||||
VIR_FREE(info_ret);
|
||||
}
|
||||
virBitmapFree(bitmap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user