summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-04-09 11:09:07 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-09 11:09:07 +0100
commit7c7e19cf50d76568e2637ad66b095044a41c6a82 (patch)
tree39534337197e3f8f2d713910050a977877effe33 /src/alloc.c
parent5e1792270a072a96157e5d5e1d6a97414e26d0bf (diff)
downloadvim-git-7c7e19cf50d76568e2637ad66b095044a41c6a82.tar.gz
patch 8.2.4716: memory allocation failure not tested when defining a functionv8.2.4716
Problem: Memory allocation failure not tested when defining a function. Solution: Add a test. (Yegappan Lakshmanan, closes #10127)
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 9547d6719..5218d0046 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -719,6 +719,20 @@ ga_grow(garray_T *gap, int n)
return OK;
}
+/*
+ * Same as ga_grow() but uses an allocation id for testing.
+ */
+ int
+ga_grow_id(garray_T *gap, int n, alloc_id_T id UNUSED)
+{
+#ifdef FEAT_EVAL
+ if (alloc_fail_id == id && alloc_does_fail(sizeof(list_T)))
+ return FAIL;
+#endif
+
+ return ga_grow(gap, n);
+}
+
int
ga_grow_inner(garray_T *gap, int n)
{