From 9ab9ae3784f20d53db35105d6319a9097c67a7ae Mon Sep 17 00:00:00 2001 From: ramonn Date: Thu, 19 Jan 2012 12:38:36 +0000 Subject: [PATCH] 2012-01-19 Ramon Novoa * modules/pandora_module_odbc.cc: Check for NULL pointers. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5392 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/win32/ChangeLog | 4 ++++ .../win32/modules/pandora_module_odbc.cc | 21 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) 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 ()) {