projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
smart plugin: add option to store data using serial number
[collectd.git]
/
src
/
oracle.c
diff --git
a/src/oracle.c
b/src/oracle.c
index
84d9ed4
..
cb9b3db
100644
(file)
--- a/
src/oracle.c
+++ b/
src/oracle.c
@@
-174,7
+174,7
@@
static void o_database_free (o_database_t *db) /* {{{ */
* ValuesFrom "value"
* </Result>
* </Query>
* ValuesFrom "value"
* </Result>
* </Query>
- *
+ *
* <Database "plugin_instance1">
* ConnectID "db01"
* Username "oracle"
* <Database "plugin_instance1">
* ConnectID "db01"
* Username "oracle"
@@
-198,13
+198,12
@@
static int o_config_add_database (oconfig_item_t *ci) /* {{{ */
return (-1);
}
return (-1);
}
- db =
malloc (
sizeof (*db));
+ db =
calloc (1,
sizeof (*db));
if (db == NULL)
{
if (db == NULL)
{
- ERROR ("oracle plugin:
m
alloc failed.");
+ ERROR ("oracle plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (db, 0, sizeof (*db));
db->name = NULL;
db->host = NULL;
db->connect_id = NULL;
db->name = NULL;
db->host = NULL;
db->connect_id = NULL;
@@
-273,7
+272,7
@@
static int o_config_add_database (oconfig_item_t *ci) /* {{{ */
if (db->q_prep_areas == NULL)
{
if (db->q_prep_areas == NULL)
{
- WARNING ("oracle plugin:
m
alloc failed");
+ WARNING ("oracle plugin:
c
alloc failed");
status = -1;
break;
}
status = -1;
break;
}
@@
-300,7
+299,7
@@
static int o_config_add_database (oconfig_item_t *ci) /* {{{ */
{
o_database_t **temp;
{
o_database_t **temp;
- temp =
(o_database_t **)
realloc (databases,
+ temp = realloc (databases,
sizeof (*databases) * (databases_num + 1));
if (temp == NULL)
{
sizeof (*databases) * (databases_num + 1));
if (temp == NULL)
{
@@
-463,7
+462,7
@@
static int o_read_database_query (o_database_t *db, /* {{{ */
{
ub4 param_counter = 0;
status = OCIAttrGet (oci_statement, OCI_HTYPE_STMT, /* {{{ */
{
ub4 param_counter = 0;
status = OCIAttrGet (oci_statement, OCI_HTYPE_STMT, /* {{{ */
- ¶m_counter, /* size pointer = */ NULL,
+ ¶m_counter, /* size pointer = */ NULL,
OCI_ATTR_PARAM_COUNT, oci_error);
if (status != OCI_SUCCESS)
{
OCI_ATTR_PARAM_COUNT, oci_error);
if (status != OCI_SUCCESS)
{
@@
-476,7
+475,7
@@
static int o_read_database_query (o_database_t *db, /* {{{ */
} while (0); /* }}} */
/* Allocate the following buffers:
} while (0); /* }}} */
/* Allocate the following buffers:
- *
+ *
* +---------------+-----------------------------------+
* ! Name ! Size !
* +---------------+-----------------------------------+
* +---------------+-----------------------------------+
* ! Name ! Size !
* +---------------+-----------------------------------+
@@
-502,13
+501,12
@@
static int o_read_database_query (o_database_t *db, /* {{{ */
#define ALLOC_OR_FAIL(ptr, ptr_size) \
do { \
size_t alloc_size = (size_t) ((ptr_size)); \
#define ALLOC_OR_FAIL(ptr, ptr_size) \
do { \
size_t alloc_size = (size_t) ((ptr_size)); \
- (ptr) =
malloc (
alloc_size); \
+ (ptr) =
calloc (1,
alloc_size); \
if ((ptr) == NULL) { \
FREE_ALL; \
if ((ptr) == NULL) { \
FREE_ALL; \
- ERROR ("oracle plugin: o_read_database_query:
m
alloc failed."); \
+ ERROR ("oracle plugin: o_read_database_query:
c
alloc failed."); \
return (-1); \
} \
return (-1); \
} \
- memset ((ptr), 0, alloc_size); \
} while (0)
/* Initialize everything to NULL so the above works. */
} while (0)
/* Initialize everything to NULL so the above works. */
@@
-653,7
+651,7
@@
static int o_read_database (o_database_t *db) /* {{{ */
ub4 connection_status;
server_handle = NULL;
ub4 connection_status;
server_handle = NULL;
- status = OCIAttrGet ((void *) db->oci_service_context, OCI_HTYPE_SVCCTX,
+ status = OCIAttrGet ((void *) db->oci_service_context, OCI_HTYPE_SVCCTX,
(void *) &server_handle, /* size pointer = */ NULL,
OCI_ATTR_SERVER, oci_error);
if (status != OCI_SUCCESS)
(void *) &server_handle, /* size pointer = */ NULL,
OCI_ATTR_SERVER, oci_error);
if (status != OCI_SUCCESS)
@@
-745,7
+743,7
@@
static int o_shutdown (void) /* {{{ */
OCIHandleFree (databases[i]->oci_service_context, OCI_HTYPE_SVCCTX);
databases[i]->oci_service_context = NULL;
}
OCIHandleFree (databases[i]->oci_service_context, OCI_HTYPE_SVCCTX);
databases[i]->oci_service_context = NULL;
}
-
+
for (i = 0; i < queries_num; i++)
{
OCIStmt *oci_statement;
for (i = 0; i < queries_num; i++)
{
OCIStmt *oci_statement;
@@
-757,7
+755,7
@@
static int o_shutdown (void) /* {{{ */
udb_query_set_user_data (queries[i], NULL);
}
}
udb_query_set_user_data (queries[i], NULL);
}
}
-
+
OCIHandleFree (oci_env, OCI_HTYPE_ENV);
oci_env = NULL;
OCIHandleFree (oci_env, OCI_HTYPE_ENV);
oci_env = NULL;