mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virNWFilterVarCombIter: Allocate 'iter' member separately
Switch to the more common approach of having arrays allocated separately rather than trailing the struct. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
ed97683897
commit
add18b06c7
@ -304,6 +304,8 @@ virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci)
|
|||||||
for (i = 0; i < ci->nIter; i++)
|
for (i = 0; i < ci->nIter; i++)
|
||||||
g_free(ci->iter[i].varNames);
|
g_free(ci->iter[i].varNames);
|
||||||
|
|
||||||
|
g_free(ci->iter);
|
||||||
|
|
||||||
g_free(ci);
|
g_free(ci);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,8 +467,8 @@ virNWFilterVarCombIterCreate(GHashTable *hash,
|
|||||||
int iterIndex = -1;
|
int iterIndex = -1;
|
||||||
unsigned int nextIntIterId = VIR_NWFILTER_MAX_ITERID + 1;
|
unsigned int nextIntIterId = VIR_NWFILTER_MAX_ITERID + 1;
|
||||||
|
|
||||||
if (VIR_ALLOC_VAR(res, virNWFilterVarCombIterEntry, 1 + nVarAccess) < 0)
|
res = g_new0(virNWFilterVarCombIter, 1);
|
||||||
return NULL;
|
res->iter = g_new0(virNWFilterVarCombIterEntry, nVarAccess + 1);
|
||||||
|
|
||||||
res->hashTable = hash;
|
res->hashTable = hash;
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ typedef virNWFilterVarCombIter *virNWFilterVarCombIterPtr;
|
|||||||
struct _virNWFilterVarCombIter {
|
struct _virNWFilterVarCombIter {
|
||||||
GHashTable *hashTable;
|
GHashTable *hashTable;
|
||||||
size_t nIter;
|
size_t nIter;
|
||||||
virNWFilterVarCombIterEntry iter[0];
|
virNWFilterVarCombIterEntryPtr iter;
|
||||||
};
|
};
|
||||||
virNWFilterVarCombIterPtr virNWFilterVarCombIterCreate(
|
virNWFilterVarCombIterPtr virNWFilterVarCombIterCreate(
|
||||||
GHashTable *hash,
|
GHashTable *hash,
|
||||||
|
Loading…
Reference in New Issue
Block a user