From f7158d34d2554392e187a720ba05ed7508ede9cc Mon Sep 17 00:00:00 2001 From: lotherk Date: Mon, 23 Nov 2026 13:02:37 +0000 Subject: [PATCH] embed: a failed batch alloc frees the vectors it already made The remote branch allocates vec[0..n) first, then a texts[] array. When that calloc failed the function broke out with the vectors still held. Test: make check (all tests passed), tests/test_embed ok --- src/backend/embed.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/embed.c b/src/backend/embed.c index c625783..874a117 100644 --- a/src/backend/embed.c +++ b/src/backend/embed.c @@ -1059,6 +1059,8 @@ catch_up(struct sp_embed_ctx *c) if (texts == NULL) { sp_buf_puts(&err, "out of memory"); + /* the vectors are already allocated */ + vecs_free(vec, n); rc = -1; break; }