Skip to content

Commit 215030a

Browse files
authored
fix potential null pointer dereference found by coverity (#186)
CID 442459: (#2 of 2): Dereference before null check (REVERSE_INULL) check_after_deref: Null-checking conn->functions suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 3048 if ( conn -> functions ) 3049 { 3050 free( conn -> functions ); 3051 conn -> functions = NULL; 3052 }
1 parent 793d7c0 commit 215030a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

DriverManager/drivermanager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ int add_to_pool( DMHDBC connection, CPOOLHEAD *pooh );
11761176
(stmt,pn,dtp,psp,ddp,np)
11771177

11781178
#define DM_SQLDISCONNECT 21
1179-
#define CHECK_SQLDISCONNECT(con) (con->functions[21].func!=NULL)
1179+
#define CHECK_SQLDISCONNECT(con) (con->functions!=NULL && con->functions[21].func!=NULL)
11801180
#define SQLDISCONNECT(con,dbc)\
11811181
((SQLRETURN (*)(SQLHDBC))\
11821182
con->functions[21].func)(dbc)

0 commit comments

Comments
 (0)