1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

fix: added frees for any allocated memory if the allocation of other

memory fails and the FAIL_UNLESS calls needed the stop the test if this
happens
This commit is contained in:
Pavol Sloboda
2025-04-11 13:01:52 +02:00
committed by Georg Richter
parent 7009f60416
commit 056f09bb06

View File

@@ -2677,11 +2677,19 @@ static int test_bug5194(MYSQL *mysql)
check_mysql_rc(rc, mysql);
my_bind= (MYSQL_BIND*) malloc(MAX_PARAM_COUNT * sizeof(MYSQL_BIND));
FAIL_UNLESS(my_bind, "Not enough memory");
query= (char*) malloc(strlen(query_template) +
MAX_PARAM_COUNT * CHARS_PER_PARAM + 1);
if(!query)
free(my_bind);
FAIL_UNLESS(query, "Not enough memory");
param_str= (char*) malloc(COLUMN_COUNT * CHARS_PER_PARAM);
FAIL_IF(my_bind == 0 || query == 0 || param_str == 0, "Not enough memory");
if(!param_str)
{
free(my_bind);
free(query);
}
FAIL_UNLESS(param_str, "Not enough memory");
stmt= mysql_stmt_init(mysql);