libvirt/SOURCES/libvirt-vircgroupv2-fix-abo...

66 lines
2.5 KiB
Diff

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