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;