apr/backport-memory-unix-apr_pools.c-apr_pool_cleanup_register.patch
2024-08-13 17:28:33 +08:00

37 lines
1.1 KiB
Diff

From 54bc039ca9781c75b51ad39a01ae79d30efd6f09 Mon Sep 17 00:00:00 2001
From: Rainer Jung <rjung@apache.org>
Date: Wed, 17 Jul 2019 11:15:08 +0000
Subject: [PATCH] * memory/unix/apr_pools.c (apr_pool_cleanup_register):
[APR_POOL_DEBUG]: Catch NULL arguments which would lead to strange
segfaults later.
Backport of r1082177 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1863198 13f79535-47bb-0310-9956-ffa450edef68
Reference:https://github.com/apache/apr/commit/54bc039ca9781c75b51ad39a01ae79d30efd6f09
Conflict:NA
---
memory/unix/apr_pools.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 524e9acb4..3361f7a7d 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -2509,6 +2509,10 @@ APR_DECLARE(void) apr_pool_cleanup_register(apr_pool_t *p, const void *data,
#if APR_POOL_DEBUG
apr_pool_check_integrity(p);
+
+ if (!p || !plain_cleanup_fn || !child_cleanup_fn) {
+ abort();
+ }
#endif /* APR_POOL_DEBUG */
if (p != NULL) {
--
2.23.0