From 0fc940259a516e70301bdf7eda3db62b47604988 Mon Sep 17 00:00:00 2001 From: Pavol Sloboda Date: Mon, 26 May 2025 12:27:39 +0200 Subject: [PATCH] Added the call to FAIL_UNLESS to handle the possibility of the allocation of buffer failing to ensure we don't work with NULL further in the test, also added a free to bind in this case to avoid a memory leak --- unittest/libmariadb/ps_bugs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unittest/libmariadb/ps_bugs.c b/unittest/libmariadb/ps_bugs.c index 34dd3926..6284f6dc 100644 --- a/unittest/libmariadb/ps_bugs.c +++ b/unittest/libmariadb/ps_bugs.c @@ -5172,6 +5172,9 @@ static int test_maxparam(MYSQL *mysql) check_mysql_rc(rc, mysql); buffer= calloc(1, mem); + if(!buffer) + free(bind); + FAIL_UNLESS(bind, "Not enough memory"); strcpy(buffer, query); for (i=0; i < 65534.; i++) strcat(buffer, ",(?)");