]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[apr] Fix potential dereference of a null pointer when apr_pool_create_ex() is called... 385/head
authorAndrey Volk <andywolk@gmail.com>
Wed, 19 Feb 2020 10:27:36 +0000 (14:27 +0400)
committerAndrey Volk <andywolk@gmail.com>
Wed, 19 Feb 2020 10:38:56 +0000 (14:38 +0400)
libs/apr/memory/unix/apr_pools.c

index c412a4aef05090993bc56556d9d8a3b3033933ef..7e37a5d0a079ef2b6afef5b02be4aa1002141c97 100644 (file)
@@ -821,8 +821,17 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
     if (!abort_fn && parent)
         abort_fn = parent->abort_fn;
 
-    if (allocator == NULL)
+    if (allocator == NULL) {
+        if (!parent) {
+            /* There is no way to continue without an allocator when no parent */
+            if (abort_fn)
+                abort_fn(APR_EINVAL);
+
+            return APR_EINVAL;
+        }
+
         allocator = parent->allocator;
+    }
 
     if ((node = allocator_alloc(allocator,
                                 MIN_ALLOC - APR_MEMNODE_T_SIZE)) == NULL) {