[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt PATCH 2/6] conf: use g_strdupv instead of virStringListCopy



On Mon, Aug 03, 2020 at 12:25:30AM +0200, Ján Tomko wrote:
Also remove the temporary variable - even virStringListCopy
aborts on OOM now.

Signed-off-by: Ján Tomko <jtomko redhat com>
---
src/conf/domain_capabilities.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)


Reviewed-by: Martin Kletzander <mkletzan redhat com>


diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 837b004334..4b867dd997 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -199,14 +199,10 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
                          char **blockers)
{
    g_autofree char * nameCopy = NULL;
-    VIR_AUTOSTRINGLIST blockersCopy = NULL;
    virDomainCapsCPUModelPtr cpu;

    nameCopy = g_strdup(name);

-    if (virStringListCopy(&blockersCopy, (const char **)blockers) < 0)
-        return -1;
-
    if (VIR_RESIZE_N(cpuModels->models, cpuModels->nmodels_max,
                     cpuModels->nmodels, 1) < 0)
        return -1;
@@ -216,7 +212,7 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,

    cpu->usable = usable;
    cpu->name = g_steal_pointer(&nameCopy);
-    cpu->blockers = g_steal_pointer(&blockersCopy);
+    cpu->blockers = g_strdupv(blockers);

    return 0;
}
--
2.26.2

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]