diff --git a/cur/SQLExecDirect.c b/cur/SQLExecDirect.c index 670694f..2055636 100644 --- a/cur/SQLExecDirect.c +++ b/cur/SQLExecDirect.c @@ -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 ++ ) { diff --git a/ini/iniObjectInsert.c b/ini/iniObjectInsert.c index d5d2916..0ffe1b4 100644 --- a/ini/iniObjectInsert.c +++ b/ini/iniObjectInsert.c @@ -30,6 +30,8 @@ int iniObjectInsert( HINI hIni, char *pszObject ) /* CREATE OBJECT STRUCT */ hObject = malloc( sizeof(INIOBJECT) ); + if ( !hObject ) + return INI_ERROR; hIni->hCurProperty = NULL; hObject->hFirstProperty = NULL; hObject->hLastProperty = NULL; diff --git a/ini/iniOpen.c b/ini/iniOpen.c index 20991fe..d4eae67 100644 --- a/ini/iniOpen.c +++ b/ini/iniOpen.c @@ -184,6 +184,8 @@ int iniOpen( HINI *hIni, char *pszFileName, char *cComment, char cLeftBracket, c /* INIT STATEMENT */ *hIni = malloc( sizeof(INI) ); + if ( !*hIni ) + return INI_ERROR; if ( pszFileName && pszFileName != STDINFILE ) strncpy((*hIni)->szFileName, pszFileName, ODBC_FILENAME_MAX ); else if ( pszFileName == STDINFILE ) @@ -363,6 +365,8 @@ int iniOpen( HINI *hIni, char *pszFileName, char *cComment, char cLeftBracket, c /* INIT STATEMENT */ *hIni = malloc( sizeof(INI) ); + if ( !*hIni ) + return INI_ERROR; if ( pszFileName && pszFileName != STDINFILE ) strncpy((*hIni)->szFileName, pszFileName, ODBC_FILENAME_MAX ); else if ( pszFileName == STDINFILE ) diff --git a/log/logOpen.c b/log/logOpen.c index 5579f3c..b539455 100644 --- a/log/logOpen.c +++ b/log/logOpen.c @@ -41,6 +41,8 @@ int logOpen( HLOG *phLog, char *pszProgramName, char *pszLogFile, long nMaxMsgs /* LOG STRUCT */ *phLog = malloc( sizeof(LOG) ); + if ( !*phLog ) + return LOG_ERROR; (*phLog)->nMaxMsgs = nMaxMsgs; (*phLog)->hMessages = lstOpen(); (*phLog)->bOn = 0;