diff --git a/pandora_agents/win32/ChangeLog b/pandora_agents/win32/ChangeLog index ba879aed07..fa21f2f402 100644 --- a/pandora_agents/win32/ChangeLog +++ b/pandora_agents/win32/ChangeLog @@ -1,3 +1,7 @@ +2012-01-19 Ramon Novoa + + * modules/pandora_module_odbc.cc: Check for NULL pointers. + 2012-01-04 Ramon Novoa * modules/pandora_module.cc: Fixed an error when checking multiple diff --git a/pandora_agents/win32/modules/pandora_module_odbc.cc b/pandora_agents/win32/modules/pandora_module_odbc.cc index c3c6b3e0e3..12787e3819 100755 --- a/pandora_agents/win32/modules/pandora_module_odbc.cc +++ b/pandora_agents/win32/modules/pandora_module_odbc.cc @@ -143,13 +143,28 @@ void Pandora_Module_Odbc::doQuery () { string retval; auto_ptr statement; + Statement *statement_ptr; auto_ptr results; + ResultSet *results_ptr; ResultSetMetaData *metadata; int columns; - statement = auto_ptr (this->con->createStatement ()); - results = auto_ptr (statement->executeQuery (query)); - metadata = results->getMetaData (); + statement_ptr = this->con->createStatement (); + if (statement_ptr == NULL) { + return; + } + statement = auto_ptr (statement_ptr); + + results_ptr = statement->executeQuery (query); + if (results_ptr == NULL) { + return; + } + results = auto_ptr (results_ptr); + metadata = results->getMetaData (); + if (metadata == NULL) { + return; + } + columns = metadata->getColumnCount (); if (results->next ()) {