render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c480ed
From c627fa58c17960e5eed999049bf966b5ea952c3b Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <c627fa58c17960e5eed999049bf966b5ea952c3b@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Fri, 30 Aug 2019 16:35:33 +0200
c480ed
Subject: [PATCH] vircgroupv2: fix abort in VIR_AUTOFREE
c480ed
c480ed
Introduced by commit <c854e0bd33c7a5afb04a36465bf04f861b2efef5> that
c480ed
tried to fix an issue where we would fail to parse values from files.
c480ed
c480ed
We cannot change the original pointer that is going to be used by
c480ed
VIR_AUTOFREE.
c480ed
c480ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1747440
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Acked-by: Peter Krempa <pkrempa@redhat.com>
c480ed
(cherry picked from commit 9a99b01f8d3b2be491f9f8412c6f894d30d7e2fe)
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Message-Id: <c9be614c3648b2901481f257ba1af3fcd8fe7e76.1567175708.git.phrdina@redhat.com>
c480ed
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
c480ed
---
c480ed
 src/util/vircgroupv2.c | 6 ++++--
c480ed
 1 file changed, 4 insertions(+), 2 deletions(-)
c480ed
c480ed
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
c480ed
index e31a2d1121..e7b9093754 100644
c480ed
--- a/src/util/vircgroupv2.c
c480ed
+++ b/src/util/vircgroupv2.c
c480ed
@@ -848,6 +848,7 @@ virCgroupV2GetBlkioDeviceWeight(virCgroupPtr group,
c480ed
     VIR_AUTOFREE(char *) path = NULL;
c480ed
     VIR_AUTOFREE(char *) str = NULL;
c480ed
     VIR_AUTOFREE(char *) value = NULL;
c480ed
+    char *tmp;
c480ed
 
c480ed
     if (virCgroupV2PathOfController(group, VIR_CGROUP_CONTROLLER_BLKIO,
c480ed
                                     "io.weight", &path) < 0) {
c480ed
@@ -868,7 +869,7 @@ virCgroupV2GetBlkioDeviceWeight(virCgroupPtr group,
c480ed
 
c480ed
     if (!str) {
c480ed
         *weight = 0;
c480ed
-    } else if (virStrToLong_ui(str, &str, 10, weight) < 0) {
c480ed
+    } else if (virStrToLong_ui(str, &tmp, 10, weight) < 0) {
c480ed
         virReportError(VIR_ERR_INTERNAL_ERROR,
c480ed
                        _("Unable to parse '%s' as an integer"),
c480ed
                        str);
c480ed
@@ -1575,6 +1576,7 @@ virCgroupV2GetCpuCfsQuota(virCgroupPtr group,
c480ed
                           long long *cfs_quota)
c480ed
 {
c480ed
     VIR_AUTOFREE(char *) str = NULL;
c480ed
+    char *tmp;
c480ed
 
c480ed
     if (virCgroupGetValueStr(group, VIR_CGROUP_CONTROLLER_CPU,
c480ed
                              "cpu.max", &str) < 0) {
c480ed
@@ -1586,7 +1588,7 @@ virCgroupV2GetCpuCfsQuota(virCgroupPtr group,
c480ed
         return 0;
c480ed
     }
c480ed
 
c480ed
-    if (virStrToLong_ll(str, &str, 10, cfs_quota) < 0) {
c480ed
+    if (virStrToLong_ll(str, &tmp, 10, cfs_quota) < 0) {
c480ed
         virReportError(VIR_ERR_INTERNAL_ERROR,
c480ed
                        _("Failed to parse value '%s' from cpu.max."), str);
c480ed
         return -1;
c480ed
-- 
c480ed
2.23.0
c480ed