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

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

 



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@xxxxxxxxxx>
---
src/conf/domain_capabilities.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)


Reviewed-by: Martin Kletzander <mkletzan@xxxxxxxxxx>


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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux