Skip to content

Commit

Permalink
ODBC-390 Using SQL_ATTR_QUERY_TIMEOUT leaks memory
Browse files Browse the repository at this point in the history
The string with new query text in MADB_AddQueryTime was allocated and
then duplicated, when copied to the Stmt structures, but not freed.
  • Loading branch information
lawrinn committed Apr 28, 2023
1 parent 313102f commit c0d989b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ma_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,8 @@ void MADB_AddQueryTime(MADB_QUERY* Query, unsigned long long Timeout)

Query->Length= _snprintf(NewStr, NewSize, "SET STATEMENT max_statement_time=%llu FOR %s", Timeout, Query->Original);

MADB_RESET(Query->Original, NewStr);
MADB_FREE(Query->Original);
Query->Original= NewStr;
}

/* {{{ MADB_StmtPrepare */
Expand Down

0 comments on commit c0d989b

Please sign in to comment.