Skip to content

Commit

Permalink
handle memory allocation failures
Browse files Browse the repository at this point in the history
  • Loading branch information
chipitsine committed Oct 20, 2024
1 parent 77a621e commit bccbb41
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cur/SQLExecDirect.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,23 @@ SQLRETURN get_column_names( CLHSTMT cl_statement )

cl_statement -> column_names = malloc( sizeof(char *)
* cl_statement -> column_count );
if ( !cl_statement->column_names )
return SQL_ERROR;

cl_statement -> data_type = malloc( sizeof( SQLSMALLINT )
* cl_statement -> column_count );
if ( !cl_statement->data_type )
return SQL_ERROR;

cl_statement -> column_size = malloc( sizeof( SQLULEN )
* cl_statement -> column_count );
if ( !cl_statement->column_size )
return SQL_ERROR;

cl_statement -> decimal_digits = malloc( sizeof( SQLSMALLINT )
* cl_statement -> column_count );
if ( !cl_statement->decimal_digits )
return SQL_ERROR;

for ( i = 1; i <= cl_statement -> column_count; i ++ )
{
Expand Down

0 comments on commit bccbb41

Please sign in to comment.