From 713e7dfecabb2b15d5143063f6693fd41f41b33d Mon Sep 17 00:00:00 2001 From: lxuechao <53655653+lxuechao@users.noreply.github.com> Date: Wed, 17 Jul 2024 11:44:21 +0800 Subject: [PATCH] Update sm_pool.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这里似乎有个判断错误,当do_zero非空时,释放内存需要memset --- sm_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sm_pool.c b/sm_pool.c index 451d2d5..03c1970 100644 --- a/sm_pool.c +++ b/sm_pool.c @@ -40,7 +40,7 @@ int sm_set_pool(struct smalloc_pool *spool, void *new_pool, size_t new_pool_size if (!new_pool || !new_pool_size) { if (smalloc_verify_pool(spool)) { - if (spool->do_zero) memset(spool->pool, 0, spool->pool_size); + if (!spool->do_zero) memset(spool->pool, 0, spool->pool_size); memset(spool, 0, sizeof(struct smalloc_pool)); return 1; }