Fetch the repository succeeded.
This action will force synchronization from src-openEuler/qemu, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
From 7cb2d342b9073ec9548202df6e1fb25fa4997d71 Mon Sep 17 00:00:00 2001
From: jianchunfu <jianchunfu_yewu@cmss.chinamobile.com>
Date: Thu, 30 Jun 2022 11:34:50 +0000
Subject: [PATCH] migration/dirtyrate: Replace malloc with g_new Using macro
g_new() to handling potential memory allocation failures in dirtyrate.
---
migration/dirtyrate.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
index d65e744af9..8043bc7946 100644
--- a/migration/dirtyrate.c
+++ b/migration/dirtyrate.c
@@ -157,7 +157,7 @@ static void cleanup_dirtyrate_stat(struct DirtyRateConfig config)
{
/* last calc-dirty-rate qmp use dirty ring mode */
if (dirtyrate_mode == DIRTY_RATE_MEASURE_MODE_DIRTY_RING) {
- free(DirtyStat.dirty_ring.rates);
+ g_free(DirtyStat.dirty_ring.rates);
DirtyStat.dirty_ring.rates = NULL;
}
}
@@ -522,10 +522,10 @@ static void calculate_dirtyrate_dirty_ring(struct DirtyRateConfig config)
nvcpu++;
}
- dirty_pages = malloc(sizeof(*dirty_pages) * nvcpu);
+ dirty_pages = g_new(DirtyPageRecord, nvcpu);
DirtyStat.dirty_ring.nvcpu = nvcpu;
- DirtyStat.dirty_ring.rates = malloc(sizeof(DirtyRateVcpu) * nvcpu);
+ DirtyStat.dirty_ring.rates = g_new(DirtyRateVcpu, nvcpu);
dirtyrate_global_dirty_log_start();
@@ -556,7 +556,7 @@ static void calculate_dirtyrate_dirty_ring(struct DirtyRateConfig config)
}
DirtyStat.dirty_rate = dirtyrate_sum;
- free(dirty_pages);
+ g_free(dirty_pages);
}
static void calculate_dirtyrate_sample_vm(struct DirtyRateConfig config)
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。