Skip to content

Commit

Permalink
fix potential null pointer dereference found by coverity (#185)
Browse files Browse the repository at this point in the history
CID 442404: (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking cl_connection->functions suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
452        if ( cl_connection -> functions ) {
453            free( cl_connection -> functions );
454        }
455
456        free( cl_connection );
  • Loading branch information
chipitsine authored Oct 7, 2024
1 parent 215030a commit a9a66e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cur/SQLConnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,9 @@ SQLRETURN CLDisconnect( SQLHDBC connection_handle )
* disconnect from the driver
*/

ret = SQLDISCONNECT( cl_connection,
cl_connection -> driver_dbc );
ret = cl_connection -> functions ?
SQLDISCONNECT( cl_connection, cl_connection -> driver_dbc ) :
-1;

if ( SQL_SUCCEEDED( ret ))
{
Expand Down

0 comments on commit a9a66e6

Please sign in to comment.