[PATCH v2 1/2] odbc32: SQLAllocEnv handle NULL parameter

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Mon Nov 9 03:48:18 CST 2020


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/odbc32/proxyodbc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 0c0b30f0bef..d6e872aad48 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -55,7 +55,8 @@ static SQLRETURN WINAPI null_SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC
 
 static SQLRETURN WINAPI null_SQLAllocEnv(SQLHENV *EnvironmentHandle)
 {
-    *EnvironmentHandle = SQL_NULL_HENV;
+    if (EnvironmentHandle)
+        *EnvironmentHandle = SQL_NULL_HENV;
     TRACE("Not ready\n");
     return SQL_ERROR;
 }
@@ -1232,7 +1233,7 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle)
     TRACE("(EnvironmentHandle %p)\n", EnvironmentHandle);
 
     ret = sql_funcs.pSQLAllocEnv(EnvironmentHandle);
-    TRACE("Returning %d, EnvironmentHandle %p\n", ret, *EnvironmentHandle);
+    TRACE("Returning %d, EnvironmentHandle %p\n", ret, EnvironmentHandle ? *EnvironmentHandle : NULL);
     return ret;
 }
 
-- 
2.28.0




More information about the wine-devel mailing list