Skip to content

Commit 5831a69

Browse files
committed
Fix for CONC-178:
When a cursor was not properly cleared (all results weren't fetched) the clear_result routine has to free result sets only if field_count > 0.
1 parent eb48926 commit 5831a69

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mariadb/mariadb_cursor.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,14 @@ PyObject *MrdbCursor_clear_result(MrdbCursor *self)
405405
self->stmt)
406406
{
407407
/* free current result */
408-
mysql_stmt_free_result(self->stmt);
408+
if (mysql_stmt_field_count(self->stmt))
409+
mysql_stmt_free_result(self->stmt);
409410

410411
/* check if there are more pending result sets */
411412
while (mysql_stmt_next_result(self->stmt) == 0)
412413
{
413-
mysql_stmt_free_result(self->stmt);
414+
if (mysql_stmt_field_count(self->stmt))
415+
mysql_stmt_free_result(self->stmt);
414416
}
415417
} else if (self->parseinfo.is_text)
416418
{

0 commit comments

Comments
 (0)