You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fix for CONC-642: Set CR_OUT_OF_MEMORY error
Set CR_OUT_OF_MEMORY error in mysql_use_result() api function if allocation of memory failed.
This commit is contained in:
@@ -2482,12 +2482,16 @@ mysql_use_result(MYSQL *mysql)
|
|||||||
}
|
}
|
||||||
if (!(result=(MYSQL_RES*) calloc(1, sizeof(*result)+
|
if (!(result=(MYSQL_RES*) calloc(1, sizeof(*result)+
|
||||||
sizeof(ulong)*mysql->field_count)))
|
sizeof(ulong)*mysql->field_count)))
|
||||||
|
{
|
||||||
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
return(0);
|
return(0);
|
||||||
|
}
|
||||||
result->lengths=(ulong*) (result+1);
|
result->lengths=(ulong*) (result+1);
|
||||||
if (!(result->row=(MYSQL_ROW)
|
if (!(result->row=(MYSQL_ROW)
|
||||||
malloc(sizeof(result->row[0])*(mysql->field_count+1))))
|
malloc(sizeof(result->row[0])*(mysql->field_count+1))))
|
||||||
{ /* Ptrs: to one row */
|
{ /* Ptrs: to one row */
|
||||||
free(result);
|
free(result);
|
||||||
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
result->fields= mysql->fields;
|
result->fields= mysql->fields;
|
||||||
|
Reference in New Issue
Block a user