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

fix: added the necessary frees for the bind var before any of the

check_stmt_rc() and check_mysql_rc() macros potentialy return from the
fuction
This commit is contained in:
Pavol Sloboda
2025-04-11 13:46:11 +02:00
committed by Georg Richter
parent 92a8b3b529
commit 9fb319a7e7

View File

@@ -5167,9 +5167,13 @@ static int test_maxparam(MYSQL *mysql)
FAIL_UNLESS(bind, "Not enough memory");
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
if (rc)
free(bind);
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "CREATE TABLE t1 (a int)");
if (rc)
free(bind);
check_mysql_rc(rc, mysql);
buffer= calloc(1, mem);
@@ -5180,6 +5184,8 @@ static int test_maxparam(MYSQL *mysql)
for (i=0; i < 65534.; i++)
strcat(buffer, ",(?)");
rc= mysql_stmt_prepare(stmt, SL(buffer));
if (rc)
free(bind);
check_stmt_rc(rc, stmt);
for (i=0; i < 65534; i++)
@@ -5189,9 +5195,13 @@ static int test_maxparam(MYSQL *mysql)
}
rc= mysql_stmt_bind_param(stmt, bind);
if (rc)
free(bind);
check_stmt_rc(rc, stmt);
rc= mysql_stmt_execute(stmt);
if (rc)
free(bind);
check_stmt_rc(rc, stmt);
FAIL_IF(mysql_stmt_affected_rows(stmt) != 65535, "Expected affected_rows=65535");